Version Notes
Stable Release
Download this release
Release Info
Developer | FreightCenter, Inc. |
Extension | FreightCenter_Freight_Shipping |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- BOLCheck.php +75 -0
- RemoveFreight.php +45 -0
- api_cancel.php +127 -0
- api_check.php +262 -0
- api_check_new.php +731 -0
- app/code/local/Excellence/Fee/Block/Sales/Order/Total.php +65 -0
- app/code/local/Excellence/Fee/Helper/Data.php +8 -0
- app/code/local/Excellence/Fee/Model/Fee.php +92 -0
- app/code/local/Excellence/Fee/Model/Observer.php +28 -0
- app/code/local/Excellence/Fee/Model/Sales/Order/Total/Creditmemo/Fee.php +17 -0
- app/code/local/Excellence/Fee/Model/Sales/Order/Total/Invoice/Fee.php +24 -0
- app/code/local/Excellence/Fee/Model/Sales/Quote/Address/Total/Fee.php +52 -0
- app/code/local/Excellence/Fee/etc/config.xml +167 -0
- app/code/local/Excellence/Fee/sql/fee_setup/mysql4-install-0.1.0.php +14 -0
- app/code/local/Excellence/Fee/sql/fee_setup/mysql4-upgrade-0.1.0-0.1.1.php +14 -0
- app/code/local/Excellence/Fee/sql/fee_setup/mysql4-upgrade-0.1.1-0.1.2.php +14 -0
- app/code/local/Excellence/Fee/sql/fee_setup/mysql4-upgrade-0.1.2-0.1.3.php +14 -0
- app/code/local/Excellence/Fee/sql/fee_setup/mysql4-upgrade-0.1.3-0.1.4.php +17 -0
- app/code/local/Freightcenter/CustomWare/Block/Adminhtml/Collect.php +14 -0
- app/code/local/Freightcenter/CustomWare/Block/Adminhtml/Collect/Edit.php +32 -0
- app/code/local/Freightcenter/CustomWare/Block/Adminhtml/Collect/Edit/Form.php +478 -0
- app/code/local/Freightcenter/CustomWare/Block/Adminhtml/Collect/Grid.php +112 -0
- app/code/local/Freightcenter/CustomWare/Helper/Data.php +4 -0
- app/code/local/Freightcenter/CustomWare/Model/Collect.php +8 -0
- app/code/local/Freightcenter/CustomWare/Model/Mysql4/Collect.php +8 -0
- app/code/local/Freightcenter/CustomWare/Model/Mysql4/Collect/Collection.php +8 -0
- app/code/local/Freightcenter/CustomWare/controllers/Adminhtml/CollectController.php +247 -0
- app/code/local/Freightcenter/CustomWare/controllers/Adminhtml/CollectController.php@1Aug +241 -0
- app/code/local/Freightcenter/CustomWare/etc/adminhtml.xml +43 -0
- app/code/local/Freightcenter/CustomWare/etc/config.xml +81 -0
- app/code/local/Freightcenter/CustomWare/sql/freightcenter_customware_setup/mysql4-install-1.0.0.php +315 -0
- app/code/local/Freightcenter/Frieghtadmin/Block/Adminhtml/Order/View/Tab/Frieghtadmin.php +32 -0
- app/code/local/Freightcenter/Frieghtadmin/Block/Adminhtml/Sales/Order/View/Frieghtadmin.php +173 -0
- app/code/local/Freightcenter/Frieghtadmin/Block/Adminhtml/Sales/Order/View/Tab/Frieghtadmin.php +67 -0
- app/code/local/Freightcenter/Frieghtadmin/etc/config.xml +25 -0
- app/code/local/Freightcenter/Frieghtadmin/sql/freightcenters_freight_setup/mysql4-install-1.0.0.php +39 -0
- app/code/local/Freightcenter/Ship/Block/Adminhtml/System/Config/Cdisplay.php +37 -0
- app/code/local/Freightcenter/Ship/Block/Adminhtml/System/Config/Destloctype.php +40 -0
- app/code/local/Freightcenter/Ship/Block/Adminhtml/System/Config/Positions.php +40 -0
- app/code/local/Freightcenter/Ship/Block/Ship.php +5 -0
- app/code/local/Freightcenter/Ship/Helper/Data.php +6 -0
- app/code/local/Freightcenter/Ship/Model/Carrier/Flatrate.php +103 -0
- app/code/local/Freightcenter/Ship/Model/Carrier/Freightcenter.php +213 -0
- app/code/local/Freightcenter/Ship/Model/CarrierDisplay.php +18 -0
- app/code/local/Freightcenter/Ship/Model/Carriers.php +32 -0
- app/code/local/Freightcenter/Ship/Model/Carriers_23rdMay.php +31 -0
- app/code/local/Freightcenter/Ship/Model/Discount.php +18 -0
- app/code/local/Freightcenter/Ship/Model/Flatrate.php__ +101 -0
- app/code/local/Freightcenter/Ship/Model/Loctypes.php +22 -0
- app/code/local/Freightcenter/Ship/Model/Mark.php +19 -0
- app/code/local/Freightcenter/Ship/Model/Mode.php +18 -0
- app/code/local/Freightcenter/Ship/Model/Sand.php +18 -0
- app/code/local/Freightcenter/Ship/Model/Types.php +18 -0
- app/code/local/Freightcenter/Ship/controllers/CartController.php +561 -0
- app/code/local/Freightcenter/Ship/controllers/IndexController.php +5 -0
- app/code/local/Freightcenter/Ship/controllers/System/ConfigController.php +285 -0
- app/code/local/Freightcenter/Ship/controllers/System/ConfigController.php@1Aug +282 -0
- app/code/local/Freightcenter/Ship/controllers/System/ConfigController.php@26June +253 -0
- app/code/local/Freightcenter/Ship/controllers/System/ConfigController_org23rdMay.php +257 -0
- app/code/local/Freightcenter/Ship/etc/config.xml +107 -0
- app/code/local/Freightcenter/Ship/etc/config.xml@new +126 -0
- app/code/local/Freightcenter/Ship/etc/config.xml@old +176 -0
- app/code/local/Freightcenter/Ship/etc/system.xml +237 -0
- app/code/local/Freightcenter/Ship/etc/system.xml@18July +176 -0
- app/code/local/Freightcenter/Ship/etc/system.xml@1Aug +232 -0
- app/code/local/Freightcenter/Ship/etc/system.xml@24July +176 -0
- app/code/local/Freightcenter/Ship/etc/system.xml@30July +228 -0
- app/code/local/Freightcenters/Freight/controllers/CartController.php +561 -0
- app/code/local/Freightcenters/Freight/controllers/IndexController.php +160 -0
- app/code/local/Freightcenters/Freight/controllers/IndexController.php@14Aug +160 -0
- app/code/local/Freightcenters/Freight/controllers/IndexController.php@20June +90 -0
- app/code/local/Freightcenters/Freight/controllers/IndexController_18thJune.php +90 -0
- app/code/local/Freightcenters/Freight/etc/config.xml +19 -0
- app/code/local/Freightcenters/Freight/etc/config.xml@23June +20 -0
- app/code/local/Freightcenters/Freight/sql/freightcenters_freight_setup/mysql4-install-1.0.0.php +58 -0
- app/code/local/Mage/Shipping/Block/Tracking/Ajax.php +30 -0
- app/code/local/Mage/Shipping/Block/Tracking/Popup.php +269 -0
- app/code/local/Mage/Shipping/Exception.php +31 -0
- app/code/local/Mage/Shipping/Helper/Data.php +162 -0
- app/code/local/Mage/Shipping/Model/Carrier/Abstract.php +585 -0
- app/code/local/Mage/Shipping/Model/Carrier/Flatrate.php +133 -0
- app/code/local/Mage/Shipping/Model/Carrier/Flatrate_org21stJune.php +115 -0
- app/code/local/Mage/Shipping/Model/Carrier/Freeshipping.php +126 -0
- app/code/local/Mage/Shipping/Model/Carrier/Interface.php +45 -0
- app/code/local/Mage/Shipping/Model/Carrier/Pickup.php +78 -0
- app/code/local/Mage/Shipping/Model/Carrier/Tablerate.php +280 -0
- app/code/local/Mage/Shipping/Model/Config.php +125 -0
- app/code/local/Mage/Shipping/Model/Info.php +169 -0
- app/code/local/Mage/Shipping/Model/Mysql4/Carrier/Tablerate.php +37 -0
- app/code/local/Mage/Shipping/Model/Mysql4/Carrier/Tablerate/Collection.php +38 -0
- app/code/local/Mage/Shipping/Model/Rate/Abstract.php +40 -0
- app/code/local/Mage/Shipping/Model/Rate/Request.php +140 -0
- app/code/local/Mage/Shipping/Model/Rate/Result.php +218 -0
- app/code/local/Mage/Shipping/Model/Rate/Result/Abstract.php +31 -0
- app/code/local/Mage/Shipping/Model/Rate/Result/Error.php +38 -0
- app/code/local/Mage/Shipping/Model/Rate/Result/Method.php +50 -0
- app/code/local/Mage/Shipping/Model/Resource/Carrier/Tablerate.php +471 -0
- app/code/local/Mage/Shipping/Model/Resource/Carrier/Tablerate/Collection.php +127 -0
- app/code/local/Mage/Shipping/Model/Shipment/Request.php +89 -0
- app/code/local/Mage/Shipping/Model/Shipment/Return.php +89 -0
- app/code/local/Mage/Shipping/Model/Shipping.php +506 -0
- app/code/local/Mage/Shipping/Model/Source/HandlingAction.php +35 -0
- app/code/local/Mage/Shipping/Model/Source/HandlingType.php +35 -0
- app/code/local/Mage/Shipping/Model/Tracking/Result.php +75 -0
- app/code/local/Mage/Shipping/Model/Tracking/Result/Abstract.php +31 -0
- app/code/local/Mage/Shipping/Model/Tracking/Result/Error.php +39 -0
- app/code/local/Mage/Shipping/Model/Tracking/Result/Status.php +54 -0
- app/code/local/Mage/Shipping/controllers/ShippingController.php +41 -0
- app/code/local/Mage/Shipping/controllers/TrackingController.php +98 -0
- app/code/local/Mage/Shipping/etc/adminhtml.xml +53 -0
- app/code/local/Mage/Shipping/etc/config.xml +176 -0
- app/code/local/Mage/Shipping/etc/system.xml +480 -0
- app/code/local/Mage/Shipping/sql/shipping_setup/install-1.6.0.0.php +79 -0
- app/code/local/Mage/Shipping/sql/shipping_setup/mysql4-install-0.7.0.php +51 -0
- app/code/local/Mage/Shipping/sql/shipping_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php +132 -0
- app/design/adminhtml/default/default/layout/fee.xml +56 -0
- app/design/adminhtml/default/default/layout/freightcenter/customware.xml +10 -0
- app/design/adminhtml/default/default/layout/freightcenter_frieghtadmin.xml +11 -0
- app/design/adminhtml/default/default/layout/frieghtadmin.xml +16 -0
- app/design/adminhtml/default/default/template/fee/sales/order/refunded.phtml +16 -0
- app/design/adminhtml/default/default/template/fee/sales/order/total.phtml +9 -0
- app/design/adminhtml/default/default/template/freightcenter/frieghtadmin/order/view/tab/frieghtadmin.phtml +1068 -0
- app/design/adminhtml/default/default/template/freightcenter_ship/system/config/cdisplay.phtml +5 -0
- app/design/adminhtml/default/default/template/freightcenter_ship/system/config/destloctype.phtml +10 -0
- app/design/adminhtml/default/default/template/freightcenter_ship/system/config/positions.phtml +24 -0
- app/design/adminhtml/default/default/template/sales/order/view/items.phtml +67 -0
- app/design/adminhtml/default/default/template/sales/order/view/items/renderer/default.phtml +277 -0
- app/design/frontend/base/default/layout/fee.xml +50 -0
- app/design/frontend/base/default/template/checkout/cart/shipping.phtml +158 -0
- app/design/frontend/base/default/template/checkout/onepage/agreements.phtml +51 -0
- app/design/frontend/base/default/template/checkout/onepage/billing.phtml +216 -0
- app/design/frontend/base/default/template/checkout/onepage/failure.phtml +32 -0
- app/design/frontend/base/default/template/checkout/onepage/link.phtml +29 -0
- app/design/frontend/base/default/template/checkout/onepage/login.phtml +124 -0
- app/design/frontend/base/default/template/checkout/onepage/payment.phtml +73 -0
- app/design/frontend/base/default/template/checkout/onepage/payment/info.phtml +29 -0
- app/design/frontend/base/default/template/checkout/onepage/payment/methods.phtml +73 -0
- app/design/frontend/base/default/template/checkout/onepage/progress.phtml +59 -0
- app/design/frontend/base/default/template/checkout/onepage/progress/billing.phtml +40 -0
- app/design/frontend/base/default/template/checkout/onepage/progress/payment.phtml +41 -0
- app/design/frontend/base/default/template/checkout/onepage/progress/shipping.phtml +44 -0
- app/design/frontend/base/default/template/checkout/onepage/progress/shipping_method.phtml +107 -0
- app/design/frontend/base/default/template/checkout/onepage/review.phtml +29 -0
- app/design/frontend/base/default/template/checkout/onepage/review/button.phtml +27 -0
- app/design/frontend/base/default/template/checkout/onepage/review/info.phtml +89 -0
- app/design/frontend/base/default/template/checkout/onepage/review/item.phtml +262 -0
- app/design/frontend/base/default/template/checkout/onepage/review/totals.phtml +47 -0
- app/design/frontend/base/default/template/checkout/onepage/shipping.phtml +156 -0
- app/design/frontend/base/default/template/checkout/onepage/shipping_method.phtml +139 -0
- app/design/frontend/base/default/template/checkout/onepage/shipping_method/additional.phtml +29 -0
- app/design/frontend/base/default/template/checkout/onepage/shipping_method/available.phtml +2096 -0
- app/design/frontend/base/default/template/fee/fee.phtml +65 -0
- app/design/frontend/base/default/template/page/html/head.phtml +471 -0
- app/design/frontend/base/default/template/sales/order/info.phtml +120 -0
- app/design/frontend/base/default/template/sales/order/print.phtml +101 -0
- app/design/frontend/base/default/template/tax/checkout/discount.phtml +25 -0
- app/design/frontend/base/default/template/tax/checkout/grandtotal.phtml +98 -0
- app/design/frontend/base/default/template/tax/checkout/shipping.phtml +137 -0
- app/design/frontend/base/default/template/tax/checkout/subtotal.phtml +81 -0
- app/design/frontend/base/default/template/tax/checkout/tax.phtml +86 -0
- app/design/frontend/base/default/template/tax/order/tax.phtml +98 -0
- app/etc/modules/Excellence_Fee.xml +9 -0
- app/etc/modules/Freightcenter_CustomWare.xml +9 -0
- app/etc/modules/Freightcenter_Frieghtadmin.xml +9 -0
- app/etc/modules/Freightcenter_Ship.xml +9 -0
- app/etc/modules/Freightcenters_Freight.xml +9 -0
- loctype_api.php +391 -0
- loctype_api_one.php +452 -0
- package.xml +18 -0
BOLCheck.php
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
define('MAGENTO_ROOT', getcwd());
|
3 |
+
$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
|
4 |
+
require_once $mageFilename;
|
5 |
+
Mage::init();
|
6 |
+
|
7 |
+
|
8 |
+
if(isset($_GET['bookingno'])){
|
9 |
+
$bookingno = $_GET['bookingno'];
|
10 |
+
}else{
|
11 |
+
$bookingno = '11195603';
|
12 |
+
}
|
13 |
+
|
14 |
+
if($sandbox == '1'){
|
15 |
+
$host = "sandbox.freightcenter.com";
|
16 |
+
$apishipmenturl = "http://sandbox.freightcenter.com/v04/shipments.asmx";
|
17 |
+
$apirateurl = "http://sandbox.freightcenter.com/v04/rates.asmx";
|
18 |
+
$apicarriersurl = "http://sandbox.freightcenter.com/v04/carriers.asmx";
|
19 |
+
}
|
20 |
+
else{
|
21 |
+
$host = "api.freightcenter.com";
|
22 |
+
$apishipmenturl = "http://api.freightcenter.com/v04/shipments.asmx";
|
23 |
+
$apirateurl = "http://api.freightcenter.com/v04/rates.asmx";
|
24 |
+
$apicarriersurl = "http://api.freightcenter.com/v04/carriers.asmx";
|
25 |
+
}
|
26 |
+
|
27 |
+
|
28 |
+
|
29 |
+
?>
|
30 |
+
|
31 |
+
<?php $xml='<?xml version="1.0" encoding="utf-8"?>
|
32 |
+
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
|
33 |
+
<soap12:Body>
|
34 |
+
<IsBolReadyForDownload xmlns="http://freightcenter.com/API/V04/">
|
35 |
+
<ShipmentId>'.$bookingno.'</ShipmentId>
|
36 |
+
</IsBolReadyForDownload>
|
37 |
+
</soap12:Body>
|
38 |
+
</soap12:Envelope>';
|
39 |
+
$apiurl = $apishipmenturl;
|
40 |
+
|
41 |
+
$headers = array(
|
42 |
+
"POST /V04/shipments.asmx HTTP/1.1",
|
43 |
+
"Host: sandbox.freightcenter.com",
|
44 |
+
"Content-Type: text/xml; charset=utf-8",
|
45 |
+
"Content-length: ".strlen($xml)
|
46 |
+
|
47 |
+
);
|
48 |
+
|
49 |
+
/* send curl request to get active carriers */
|
50 |
+
$soap_do = curl_init();
|
51 |
+
curl_setopt($soap_do, CURLOPT_URL, $apiurl );
|
52 |
+
curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true );
|
53 |
+
curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false);
|
54 |
+
curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false);
|
55 |
+
curl_setopt($soap_do, CURLOPT_POST, true );
|
56 |
+
curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT ,0);
|
57 |
+
curl_setopt($soap_do, CURLOPT_TIMEOUT, 400);
|
58 |
+
curl_setopt($soap_do, CURLOPT_HTTPHEADER, $headers);
|
59 |
+
curl_setopt($soap_do, CURLOPT_POSTFIELDS, $xml);
|
60 |
+
|
61 |
+
$result = curl_exec($soap_do);
|
62 |
+
|
63 |
+
curl_close($soap_do);
|
64 |
+
|
65 |
+
$p = xml_parser_create();
|
66 |
+
xml_parse_into_struct($p, $result, $vals, $index);
|
67 |
+
xml_parser_free($p);
|
68 |
+
//echo '<pre>'; print_r($vals);
|
69 |
+
foreach($vals as $charges){
|
70 |
+
if($charges['tag'] == 'ISBOLREADYFORDOWNLOADRESULT'){
|
71 |
+
echo $total_charge = $charges['value'];
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
+
?>
|
RemoveFreight.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
define('MAGENTO_ROOT', getcwd());
|
3 |
+
$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
|
4 |
+
require_once $mageFilename;
|
5 |
+
Mage::init();
|
6 |
+
$coreSession = Mage::getSingleton('core/session', array('name' => 'frontend'));
|
7 |
+
$cart = Mage::getModel('checkout/cart')->getQuote();
|
8 |
+
$session = Mage::getSingleton('checkout/session');
|
9 |
+
$items = $session->getQuote()->getAllItems();
|
10 |
+
|
11 |
+
$myarray = array();
|
12 |
+
foreach($items as $item) {
|
13 |
+
$id = $item->getProductId();
|
14 |
+
$qtyordered = $item->getQty();
|
15 |
+
$cart_products[$id] = $qtyordered;
|
16 |
+
$product = Mage::getModel('catalog/product')->load($id);
|
17 |
+
$ship_via_freight = $product->getData('ship_via_freight');
|
18 |
+
if($ship_via_freight!=1) {
|
19 |
+
$non_freight[] = $product;
|
20 |
+
?>
|
21 |
+
<?php } else {
|
22 |
+
$myarray[] = $product;
|
23 |
+
}
|
24 |
+
}
|
25 |
+
|
26 |
+
if($_GET['yes'] == 'yes'){
|
27 |
+
$cartHelper = Mage::helper('checkout/cart');
|
28 |
+
$items = $cartHelper->getCart()->getItems();
|
29 |
+
foreach($myarray as $mainarray){
|
30 |
+
|
31 |
+
$product_id = $mainarray['entity_id'];
|
32 |
+
foreach($items as $item){
|
33 |
+
if ($item->getProduct()->getId() == $product_id) {
|
34 |
+
$itemId = $item->getItemId();
|
35 |
+
$cartHelper->getCart()->removeItem($itemId)->save();
|
36 |
+
}
|
37 |
+
}
|
38 |
+
}
|
39 |
+
echo $_GET['yes'];
|
40 |
+
}
|
41 |
+
else{
|
42 |
+
echo "no";
|
43 |
+
}
|
44 |
+
|
45 |
+
?>
|
api_cancel.php
ADDED
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require 'app/Mage.php';
|
3 |
+
umask(0);
|
4 |
+
Mage::app('admin');
|
5 |
+
|
6 |
+
$sandbox = Mage::getStoreConfig('carriers/freightcenter/sandbox');
|
7 |
+
$freightuser = Mage::getStoreConfig('carriers/freightcenter/freightuser');
|
8 |
+
$freightpwd = Mage::getStoreConfig('carriers/freightcenter/freightpwd');
|
9 |
+
/* $apishipmenturl = Mage::getStoreConfig('carriers/freightcenter/apishipmenturl');
|
10 |
+
$apicarriersurl = Mage::getStoreConfig('carriers/freightcenter/apicarriersurl');
|
11 |
+
$apirateurl = Mage::getStoreConfig('carriers/freightcenter/apirateurl'); */
|
12 |
+
if($sandbox == '1'){
|
13 |
+
$host = "sandbox.freightcenter.com";
|
14 |
+
$apishipmenturl = "http://sandbox.freightcenter.com/v04/shipments.asmx";
|
15 |
+
$apirateurl = "http://sandbox.freightcenter.com/v04/rates.asmx";
|
16 |
+
$apicarriersurl = "http://sandbox.freightcenter.com/v04/carriers.asmx";
|
17 |
+
}
|
18 |
+
else{
|
19 |
+
$host = "api.freightcenter.com";
|
20 |
+
$apishipmenturl = "http://api.freightcenter.com/v04/shipments.asmx";
|
21 |
+
$apirateurl = "http://api.freightcenter.com/v04/rates.asmx";
|
22 |
+
$apicarriersurl = "http://api.freightcenter.com/v04/carriers.asmx";
|
23 |
+
}
|
24 |
+
if(isset($_GET['bookingno'])){
|
25 |
+
$bookingno = $_GET['bookingno'];
|
26 |
+
}else{
|
27 |
+
$bookingno = '11195603';
|
28 |
+
}
|
29 |
+
if(isset($_GET['quote_id'])){
|
30 |
+
$quote_id = $_GET['quote_id'];
|
31 |
+
}else{
|
32 |
+
$quote_id = '11195603';
|
33 |
+
}if(isset($_GET['product_id'])){
|
34 |
+
$product_id = $_GET['product_id'];
|
35 |
+
}else{
|
36 |
+
$product_id = '11195603';
|
37 |
+
}if(isset($_GET['agent'])){
|
38 |
+
$agent = $_GET['agent'];
|
39 |
+
}else{
|
40 |
+
$agent = 'admin';
|
41 |
+
}
|
42 |
+
|
43 |
+
|
44 |
+
|
45 |
+
?>
|
46 |
+
|
47 |
+
|
48 |
+
|
49 |
+
<?php $xml='<?xml version="1.0" encoding="utf-8"?>
|
50 |
+
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
|
51 |
+
<soap12:Body>
|
52 |
+
<CancelShipment xmlns="http://freightcenter.com/API/V04/">
|
53 |
+
<request>
|
54 |
+
<LicenseKey>3bda740c-ff39-4bdc-ab49-b0a3c08e23b4</LicenseKey>
|
55 |
+
<Username>'.$freightuser.'</Username>
|
56 |
+
<Password>'.$freightpwd.'</Password>
|
57 |
+
<ShipmentId>'.$bookingno.'</ShipmentId>
|
58 |
+
<Reason>Magento Cancelation Request</Reason>
|
59 |
+
<Agent><Name>'.$agent.'</Name></Agent>
|
60 |
+
</request>
|
61 |
+
</CancelShipment>
|
62 |
+
</soap12:Body>
|
63 |
+
</soap12:Envelope>';
|
64 |
+
$apiurl = $apishipmenturl;
|
65 |
+
|
66 |
+
$headers = array(
|
67 |
+
"POST /V04/shipments.asmx HTTP/1.1",
|
68 |
+
"Host: ".$host."",
|
69 |
+
"Content-Type: text/xml; charset=utf-8",
|
70 |
+
"Content-length: ".strlen($xml)
|
71 |
+
);
|
72 |
+
|
73 |
+
/* send curl request to get active carriers */
|
74 |
+
$soap_do = curl_init();
|
75 |
+
curl_setopt($soap_do, CURLOPT_URL, $apiurl );
|
76 |
+
curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true );
|
77 |
+
curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false);
|
78 |
+
curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false);
|
79 |
+
curl_setopt($soap_do, CURLOPT_POST, true );
|
80 |
+
curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT ,0);
|
81 |
+
curl_setopt($soap_do, CURLOPT_TIMEOUT, 400);
|
82 |
+
curl_setopt($soap_do, CURLOPT_HTTPHEADER, $headers);
|
83 |
+
curl_setopt($soap_do, CURLOPT_POSTFIELDS, $xml);
|
84 |
+
|
85 |
+
$result = curl_exec($soap_do);
|
86 |
+
|
87 |
+
curl_close($soap_do);
|
88 |
+
|
89 |
+
$p = xml_parser_create();
|
90 |
+
xml_parse_into_struct($p, $result, $vals, $index);
|
91 |
+
xml_parser_free($p);
|
92 |
+
//echo '<pre>';print_r($vals);
|
93 |
+
//echo $cancel_ship = count($vals);
|
94 |
+
foreach($vals as $ship){
|
95 |
+
if($ship['tag'] == 'TYPE' ){
|
96 |
+
$message = $ship['value'];
|
97 |
+
}
|
98 |
+
|
99 |
+
|
100 |
+
|
101 |
+
|
102 |
+
}
|
103 |
+
|
104 |
+
if($message == 'SUCCESS'){
|
105 |
+
echo $message ;
|
106 |
+
$resource = Mage::getSingleton('core/resource');
|
107 |
+
$writeConnection = $resource->getConnection('core_write');
|
108 |
+
$tableNamep = $resource->getTableName('brst_freight_shipping');
|
109 |
+
$query = "UPDATE `$tableNamep` SET final_dest ='' where quote_id = $quote_id AND product_id = $product_id";
|
110 |
+
$writeConnection->query($query);
|
111 |
+
} else if($message == ''){
|
112 |
+
echo "Cancelation of Booking is unsuccessfull";
|
113 |
+
}
|
114 |
+
else if($message == 'WARNING'){
|
115 |
+
echo "WARNING";
|
116 |
+
$resource = Mage::getSingleton('core/resource');
|
117 |
+
$writeConnection = $resource->getConnection('core_write');
|
118 |
+
$tableNamep = $resource->getTableName('brst_freight_shipping');
|
119 |
+
$query = "UPDATE `$tableNamep` SET final_dest ='' where quote_id = $quote_id AND product_id = $product_id";
|
120 |
+
$writeConnection->query($query);
|
121 |
+
}
|
122 |
+
else {
|
123 |
+
echo "Cancelation of Booking is unsuccessfull";
|
124 |
+
}
|
125 |
+
|
126 |
+
|
127 |
+
?>
|
api_check.php
ADDED
@@ -0,0 +1,262 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require 'app/Mage.php';
|
3 |
+
umask(0);
|
4 |
+
Mage::app('admin');
|
5 |
+
|
6 |
+
$sandbox = Mage::getStoreConfig('carriers/freightcenter/sandbox');
|
7 |
+
$freightuser = Mage::getStoreConfig('carriers/freightcenter/freightuser');
|
8 |
+
$freightpwd = Mage::getStoreConfig('carriers/freightcenter/freightpwd');
|
9 |
+
/* $apishipmenturl = Mage::getStoreConfig('carriers/freightcenter/apishipmenturl');
|
10 |
+
$apicarriersurl = Mage::getStoreConfig('carriers/freightcenter/apicarriersurl');
|
11 |
+
$apirateurl = Mage::getStoreConfig('carriers/freightcenter/apirateurl'); */
|
12 |
+
if($sandbox == '1'){
|
13 |
+
$host = "sandbox.freightcenter.com";
|
14 |
+
$apishipmenturl = "http://sandbox.freightcenter.com/v04/shipments.asmx";
|
15 |
+
$apirateurl = "http://sandbox.freightcenter.com/v04/rates.asmx";
|
16 |
+
$apicarriersurl = "http://sandbox.freightcenter.com/v04/carriers.asmx";
|
17 |
+
}
|
18 |
+
else{
|
19 |
+
$host = "api.freightcenter.com";
|
20 |
+
$apishipmenturl = "http://api.freightcenter.com/v04/shipments.asmx";
|
21 |
+
$apirateurl = "http://api.freightcenter.com/v04/rates.asmx";
|
22 |
+
$apicarriersurl = "http://api.freightcenter.com/v04/carriers.asmx";
|
23 |
+
}
|
24 |
+
|
25 |
+
if(isset($_GET['date_from']) && $_GET['date_from'] != NULL) {
|
26 |
+
$date_from = $_GET['date_from'];
|
27 |
+
} else {
|
28 |
+
$date_from = '2014-07-25';
|
29 |
+
}
|
30 |
+
if(isset($_GET['date_to']) && $_GET['date_to'] != NULL) {
|
31 |
+
$date_to = $_GET['date_to'];
|
32 |
+
} else {
|
33 |
+
$date_to = '2014-06-24';
|
34 |
+
}
|
35 |
+
if(isset($_GET['ware_fname']) && $_GET['ware_fname'] != NULL) {
|
36 |
+
$ware_fname = $_GET['ware_fname'];
|
37 |
+
} else {
|
38 |
+
$ware_fname = 'Jason';
|
39 |
+
}
|
40 |
+
if(isset($_GET['ware_lname']) && $_GET['ware_lname'] != NULL) {
|
41 |
+
$ware_lname = $_GET['ware_lname'];
|
42 |
+
} else {
|
43 |
+
$ware_lname = 'Maldonado';
|
44 |
+
}
|
45 |
+
if(isset($_GET['warephone']) && $_GET['warephone'] != NULL) {
|
46 |
+
$warephone = $_GET['warephone'];
|
47 |
+
} else {
|
48 |
+
$warephone = '8134479678';
|
49 |
+
}
|
50 |
+
if(isset($_GET['warepostcode']) && $_GET['warepostcode'] != NULL) {
|
51 |
+
$warepostcode = $_GET['warepostcode'];
|
52 |
+
} else {
|
53 |
+
$warepostcode = '33545';
|
54 |
+
}
|
55 |
+
if(isset($_GET['warestreet']) && $_GET['warestreet'] != NULL) {
|
56 |
+
$warestreet = $_GET['warestreet'];
|
57 |
+
} else {
|
58 |
+
$warestreet = '123';
|
59 |
+
}
|
60 |
+
if(isset($_GET['warecity']) && $_GET['warecity'] != NULL) {
|
61 |
+
$warecity = $_GET['warecity'];
|
62 |
+
} else {
|
63 |
+
$warecity = 'Wesley Chapel';
|
64 |
+
}
|
65 |
+
if(isset($_GET['warestate']) && $_GET['warestate'] != NULL) {
|
66 |
+
$warestate = $_GET['warestate'];
|
67 |
+
} else {
|
68 |
+
$warestate = 'FL';
|
69 |
+
}
|
70 |
+
if(isset($_GET['warecountry']) && $_GET['warecountry'] != NULL) {
|
71 |
+
$warecountry = $_GET['warecountry'];
|
72 |
+
} else {
|
73 |
+
$warecountry = 'US';
|
74 |
+
}
|
75 |
+
if(isset($_GET['fname']) && $_GET['fname'] != NULL) {
|
76 |
+
$fname = $_GET['fname'];
|
77 |
+
} else {
|
78 |
+
$fname = 'Jason';
|
79 |
+
}
|
80 |
+
if(isset($_GET['lname']) && $_GET['lname'] != NULL) {
|
81 |
+
$lname = $_GET['lname'];
|
82 |
+
} else {
|
83 |
+
$lname = 'Maldonado';
|
84 |
+
}
|
85 |
+
if(isset($_GET['telephone']) && $_GET['telephone'] != NULL) {
|
86 |
+
$telephone = $_GET['telephone'];
|
87 |
+
} else {
|
88 |
+
$telephone = '8134479678';
|
89 |
+
}
|
90 |
+
if(isset($_GET['pincode']) && $_GET['pincode'] != NULL) {
|
91 |
+
$pincode = $_GET['pincode'];
|
92 |
+
} else {
|
93 |
+
$pincode = '33545';
|
94 |
+
}
|
95 |
+
if(isset($_GET['street']) && $_GET['street'] != NULL) {
|
96 |
+
$street = $_GET['street'];
|
97 |
+
} else {
|
98 |
+
$street = '123';
|
99 |
+
}
|
100 |
+
if(isset($_GET['city']) && $_GET['city'] != NULL) {
|
101 |
+
$city = $_GET['city'];
|
102 |
+
} else {
|
103 |
+
$city = 'Wesley Chapel';
|
104 |
+
}
|
105 |
+
if(isset($_GET['region']) && $_GET['region'] != NULL) {
|
106 |
+
$region = $_GET['region'];
|
107 |
+
} else {
|
108 |
+
$region = 'FL';
|
109 |
+
}
|
110 |
+
if(isset($_GET['country']) && $_GET['country'] != NULL) {
|
111 |
+
$country = $_GET['country'];
|
112 |
+
} else {
|
113 |
+
$country = 'US';
|
114 |
+
}
|
115 |
+
if(isset($_GET['quote_id']) && $_GET['quote_id'] != NULL) {
|
116 |
+
$quote_id = $_GET['quote_id'];
|
117 |
+
} else {
|
118 |
+
$quote_id = '';
|
119 |
+
}
|
120 |
+
if(isset($_GET['rateid']) && $_GET['rateid'] != NULL) {
|
121 |
+
$rateid = $_GET['rateid'];
|
122 |
+
} else {
|
123 |
+
$rateid = '';
|
124 |
+
}
|
125 |
+
if(isset($_GET['product_id']) && $_GET['product_id'] != NULL) {
|
126 |
+
$product_id = $_GET['product_id'];
|
127 |
+
} else {
|
128 |
+
$product_id = '';
|
129 |
+
}
|
130 |
+
if(isset($_GET['agent']) && $_GET['agent'] != NULL) {
|
131 |
+
$agent = $_GET['agent'];
|
132 |
+
} else {
|
133 |
+
$agent = 'Admin';
|
134 |
+
}
|
135 |
+
if(isset($_GET['hour']) && $_GET['hour'] != NULL) {
|
136 |
+
$hour = $_GET['hour'];
|
137 |
+
} else {
|
138 |
+
$hour = '8pm';
|
139 |
+
}
|
140 |
+
if(isset($_GET['ware_email']) && $_GET['ware_email'] != NULL) {
|
141 |
+
$ware_email = $_GET['ware_email'];
|
142 |
+
} else {
|
143 |
+
$ware_email = 'admin@admin.com';
|
144 |
+
}
|
145 |
+
if(isset($_GET['ware_comp_name']) && $_GET['ware_comp_name'] != NULL) {
|
146 |
+
$ware_comp_name = $_GET['ware_comp_name'];
|
147 |
+
} else {
|
148 |
+
$ware_comp_name = 'brst';
|
149 |
+
}
|
150 |
+
if(isset($_GET['company']) && $_GET['company'] != NULL) {
|
151 |
+
$company = $_GET['company'];
|
152 |
+
} else {
|
153 |
+
$company = 'company';
|
154 |
+
}
|
155 |
+
if(isset($_GET['email']) && $_GET['email'] != NULL) {
|
156 |
+
$email = $_GET['email'];
|
157 |
+
} else {
|
158 |
+
$email = 'email@eamil.com';
|
159 |
+
}
|
160 |
+
|
161 |
+
|
162 |
+
|
163 |
+
|
164 |
+
$xml='<?xml version="1.0" encoding="utf-8"?>
|
165 |
+
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
|
166 |
+
<soap12:Body>
|
167 |
+
<BookRate xmlns="http://freightcenter.com/API/V04/">
|
168 |
+
<request>
|
169 |
+
<LicenseKey>3bda740c-ff39-4bdc-ab49-b0a3c08e23b4</LicenseKey>
|
170 |
+
<Username>'.$freightuser.'</Username>
|
171 |
+
<Password>'.$freightpwd.'</Password>
|
172 |
+
<RateId>'.$rateid.'</RateId>
|
173 |
+
<PickupDateFrom>'.$date_from.'T09:00:00.000-04:00</PickupDateFrom>
|
174 |
+
<PickupDateTo>'.$date_from.'T17:00:00.000-04:00</PickupDateTo>
|
175 |
+
<Origin>
|
176 |
+
<FirstName>'.$ware_fname.'</FirstName>
|
177 |
+
<LastName>'.$ware_lname.'</LastName>
|
178 |
+
<PhoneNumber>'.$warephone.'</PhoneNumber>
|
179 |
+
<StreetAddress>'.$warestreet.'</StreetAddress>
|
180 |
+
<City>'.$warecity.'</City>
|
181 |
+
<State>'.$warestate.'</State>
|
182 |
+
<PostalCode>'.$warepostcode.'</PostalCode>
|
183 |
+
<Country>'.$warecountry.'</Country>
|
184 |
+
<EmailAddress>'.$ware_email.'</EmailAddress>
|
185 |
+
<Company>'.$ware_comp_name.'</Company>
|
186 |
+
<HoursOfOperation>'.$hour.'</HoursOfOperation>
|
187 |
+
</Origin>
|
188 |
+
<Destination>
|
189 |
+
<FirstName>'.$fname.'</FirstName>
|
190 |
+
<LastName>'.$lname.'</LastName>
|
191 |
+
<PhoneNumber>'.$telephone.'</PhoneNumber>
|
192 |
+
<StreetAddress>'.$street.'</StreetAddress>
|
193 |
+
<City>'.$city.'</City>
|
194 |
+
<State>'.$region.'</State>
|
195 |
+
<PostalCode>'.$pincode.'</PostalCode>
|
196 |
+
<Country>'.$country.'</Country>
|
197 |
+
<EmailAddress>'.$email.'</EmailAddress>
|
198 |
+
<Company>'.$company.'</Company>
|
199 |
+
<HoursOfOperation></HoursOfOperation>
|
200 |
+
</Destination>
|
201 |
+
<Agent><Name>'.$agent.'</Name></Agent>
|
202 |
+
</request>
|
203 |
+
</BookRate>
|
204 |
+
</soap12:Body>
|
205 |
+
</soap12:Envelope>';
|
206 |
+
$apiurl = $apirateurl;
|
207 |
+
|
208 |
+
$headers = array(
|
209 |
+
"POST /V04/rates.asmx HTTP/1.1",
|
210 |
+
"Host: ".$host."",
|
211 |
+
"Content-Type: application/soap+xml; charset=utf-8",
|
212 |
+
"Content-length: ".strlen($xml)
|
213 |
+
);
|
214 |
+
|
215 |
+
/* send curl request to get active carriers */
|
216 |
+
$soap_do = curl_init();
|
217 |
+
curl_setopt($soap_do, CURLOPT_URL, $apiurl );
|
218 |
+
curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true );
|
219 |
+
curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false);
|
220 |
+
curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false);
|
221 |
+
curl_setopt($soap_do, CURLOPT_POST, true );
|
222 |
+
curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT ,0);
|
223 |
+
curl_setopt($soap_do, CURLOPT_TIMEOUT, 400);
|
224 |
+
curl_setopt($soap_do, CURLOPT_HTTPHEADER, $headers);
|
225 |
+
curl_setopt($soap_do, CURLOPT_POSTFIELDS, $xml);
|
226 |
+
|
227 |
+
$result = curl_exec($soap_do);
|
228 |
+
|
229 |
+
curl_close($soap_do);
|
230 |
+
|
231 |
+
$p = xml_parser_create();
|
232 |
+
xml_parse_into_struct($p, $result, $vals, $index);
|
233 |
+
xml_parser_free($p);
|
234 |
+
//echo '<pre>'; print_r($vals); echo '</pre>';
|
235 |
+
if(count($vals) != 0){
|
236 |
+
foreach($vals as $charges){
|
237 |
+
if($charges['tag'] == 'MESSAGE'){
|
238 |
+
$total_charge = $charges['value'];
|
239 |
+
}
|
240 |
+
if($charges['tag'] == 'SHIPMENTID'){
|
241 |
+
$PREPRONUMBER = $charges['value'];
|
242 |
+
}
|
243 |
+
|
244 |
+
}
|
245 |
+
|
246 |
+
$resource = Mage::getSingleton('core/resource');
|
247 |
+
$writeConnection = $resource->getConnection('core_write');
|
248 |
+
$tableNamep = $resource->getTableName('brst_freight_shipping');
|
249 |
+
$query = "UPDATE `$tableNamep` SET bookingno='$PREPRONUMBER', status='$total_charge', date_from = '$date_from', date_to = '$date_from', warehouse_name='$ware_fname' where quote_id = $quote_id AND product_id = $product_id";
|
250 |
+
$writeConnection->query($query);
|
251 |
+
?>
|
252 |
+
|
253 |
+
<?php if($PREPRONUMBER){
|
254 |
+
echo $PREPRONUMBER;
|
255 |
+
}else if($total_charge){
|
256 |
+
echo $total_charge;
|
257 |
+
} else {
|
258 |
+
echo "Shipment not successfully booked";
|
259 |
+
}?>
|
260 |
+
|
261 |
+
|
262 |
+
<?php } else{ echo "Try Again";} ?>
|
api_check_new.php
ADDED
@@ -0,0 +1,731 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
define('MAGENTO_ROOT', getcwd());
|
3 |
+
$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
|
4 |
+
require_once $mageFilename;
|
5 |
+
Mage::init();
|
6 |
+
$coreSession = Mage::getSingleton('core/session', array(
|
7 |
+
'name' => 'frontend'
|
8 |
+
));
|
9 |
+
$cart = Mage::getModel('checkout/cart')->getQuote();
|
10 |
+
|
11 |
+
$freightuser = Mage::getStoreConfig('carriers/freightcenter/freightuser');
|
12 |
+
$freightpwd = Mage::getStoreConfig('carriers/freightcenter/freightpwd');
|
13 |
+
$subtotal = Mage::helper('checkout/cart')->getQuote()->getSubtotal();
|
14 |
+
$markup = Mage::getStoreConfig('carriers/freightcenter/markup');
|
15 |
+
$markup_type = Mage::getStoreConfig('carriers/freightcenter/markup_type');
|
16 |
+
$markup_price = Mage::getStoreConfig('carriers/freightcenter/markup_price');
|
17 |
+
$discount = Mage::getStoreConfig('carriers/freightcenter/discount');
|
18 |
+
if ($discount == '1') {
|
19 |
+
$discount_amount = Mage::getStoreConfig('carriers/freightcenter/discount_amount');
|
20 |
+
$discount_price = Mage::getStoreConfig('carriers/freightcenter/discount_price');
|
21 |
+
|
22 |
+
} else {
|
23 |
+
$discount_amount = $subtotal + 100;
|
24 |
+
$discount_price = '0';
|
25 |
+
}
|
26 |
+
|
27 |
+
|
28 |
+
$sandbox = Mage::getStoreConfig('carriers/freightcenter/sandbox');
|
29 |
+
$apishipmenturl = Mage::getStoreConfig('carriers/freightcenter/apishipmenturl');
|
30 |
+
$apicarriersurl = Mage::getStoreConfig('carriers/freightcenter/apicarriersurl');
|
31 |
+
$apirateurl = Mage::getStoreConfig('carriers/freightcenter/apirateurl');
|
32 |
+
if ($sandbox == '1') {
|
33 |
+
$host = "sandbox.freightcenter.com";
|
34 |
+
$apishipmenturl = "http://sandbox.freightcenter.com/v04/shipments.asmx";
|
35 |
+
$apirateurl = "http://sandbox.freightcenter.com/v04/rates.asmx";
|
36 |
+
$apicarriersurl = "http://sandbox.freightcenter.com/v04/carriers.asmx";
|
37 |
+
} else {
|
38 |
+
$host = "api.freightcenter.com";
|
39 |
+
$apishipmenturl = "http://api.freightcenter.com/v04/shipments.asmx";
|
40 |
+
$apirateurl = "http://api.freightcenter.com/v04/rates.asmx";
|
41 |
+
$apicarriersurl = "http://api.freightcenter.com/v04/carriers.asmx";
|
42 |
+
}
|
43 |
+
$myarray = array();
|
44 |
+
$non_freight = array();
|
45 |
+
foreach ($cart->getAllItems() as $item) {
|
46 |
+
$productID = $item->getProduct()->getId();
|
47 |
+
$productPrice = $item->getProduct()->getPrice();
|
48 |
+
$qtyordered = $item->getQty();
|
49 |
+
|
50 |
+
$product = Mage::getModel('catalog/product')->load($productID);
|
51 |
+
$ship_via_freight = $product->getData('ship_via_freight');
|
52 |
+
if ($ship_via_freight != 1) {
|
53 |
+
$non_freight[] = $product;
|
54 |
+
?>
|
55 |
+
<!--<style>.other_method { display:none; } </style>-->
|
56 |
+
<?php
|
57 |
+
} else {
|
58 |
+
$myarray[] = $product;
|
59 |
+
}
|
60 |
+
|
61 |
+
}
|
62 |
+
|
63 |
+
$quote_id = $_GET['quote_id'];
|
64 |
+
$weights = $_GET['weight'];
|
65 |
+
if (isset($_GET['loc_val'])) {
|
66 |
+
$loc_val = $_GET['loc_val'];
|
67 |
+
} else {
|
68 |
+
$loc_val = 'Residential';
|
69 |
+
}
|
70 |
+
if (isset($_GET['address'])) {
|
71 |
+
$address = $_GET['address'];
|
72 |
+
} else {
|
73 |
+
$address = '70816';
|
74 |
+
}
|
75 |
+
$codes = '';
|
76 |
+
if (isset($_GET['accessorials'])) {
|
77 |
+
$accessorials = $_GET['accessorials'];
|
78 |
+
$accessorials = explode(",", $accessorials);
|
79 |
+
$accessorialsdisplay = count($accessorials);
|
80 |
+
for ($modz = 0; $modz < $accessorialsdisplay; $modz++) {
|
81 |
+
$codes .= '<string>' . $accessorials[$modz] . '</string>';
|
82 |
+
}
|
83 |
+
|
84 |
+
} else {
|
85 |
+
$codes = '';
|
86 |
+
}
|
87 |
+
|
88 |
+
$CarrierCode = Mage::getStoreConfig('carriers/freightcenter/positions');
|
89 |
+
$Carrierdisplay = Mage::getStoreConfig('carriers/freightcenter/carrier_display');
|
90 |
+
$CarrierCode = explode(",", $CarrierCode);
|
91 |
+
//echo count($CarrierCode);
|
92 |
+
/* if( $Carrierdisplay > count($CarrierCode))
|
93 |
+
{
|
94 |
+
$Carrierdisplay = count($CarrierCode);
|
95 |
+
} */
|
96 |
+
$carriercount = count($CarrierCode);
|
97 |
+
?>
|
98 |
+
<!--<div id="carrier_radio_select_div"></div>-->
|
99 |
+
<!--<p style="font-size: 15px; font-weight: 600;">Select Carrier</p>-->
|
100 |
+
<?php
|
101 |
+
for ($modz = 0; $modz < $carriercount; $modz++) {
|
102 |
+
|
103 |
+
$carrier_multi_rate .= " <Carrier>
|
104 |
+
<RatesRequest_Carrier>
|
105 |
+
<CarrierCode>" . $CarrierCode[$modz] . "</CarrierCode>
|
106 |
+
|
107 |
+
</RatesRequest_Carrier>
|
108 |
+
</Carrier>";
|
109 |
+
}
|
110 |
+
//echo '<pre>'; print_r($myarray); echo '</pre>';
|
111 |
+
$attribute_f = Mage::getModel('eav/config')->getAttribute('catalog_product', 'freight_class');
|
112 |
+
foreach ($attribute_f->getSource()->getAllOptions(true, true) as $opt_menuf) {
|
113 |
+
$f_attribute[$opt_menuf['value']] = $opt_menuf['label'];
|
114 |
+
}
|
115 |
+
|
116 |
+
$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'packaging_type');
|
117 |
+
foreach ($attribute->getSource()->getAllOptions(true, true) as $opt_menu1) {
|
118 |
+
$m_attribute[$opt_menu1['value']] = $opt_menu1['label'];
|
119 |
+
}
|
120 |
+
|
121 |
+
$attribute1 = Mage::getModel('eav/config')->getAttribute('catalog_product', 'origin_warehouse');
|
122 |
+
foreach ($attribute1->getSource()->getAllOptions(true, true) as $opt_menu) {
|
123 |
+
$m1_attribute[$opt_menu['value']] = $opt_menu['label'];
|
124 |
+
}
|
125 |
+
$ware_array = array();
|
126 |
+
foreach ($myarray as $proarray) {
|
127 |
+
$warehouseid = $m1_attribute[$proarray['origin_warehouse']];
|
128 |
+
|
129 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
130 |
+
$ware_query = "SELECT * FROM `brst_ship_warehouses` WHERE short_name = '$warehouseid'";
|
131 |
+
$ware_results = $connection->fetchAll($ware_query);
|
132 |
+
if ($ware_results != NULL) {
|
133 |
+
$warehousename = $ware_results[0]['short_name'];
|
134 |
+
}
|
135 |
+
|
136 |
+
if (array_key_exists($warehousename, $ware_array)) {
|
137 |
+
array_push($ware_array[$warehousename], $proarray);
|
138 |
+
} else {
|
139 |
+
$ware_array[$warehousename] = array(
|
140 |
+
$proarray
|
141 |
+
);
|
142 |
+
}
|
143 |
+
}
|
144 |
+
$myPrice = '';
|
145 |
+
$ware_count = count($ware_array);
|
146 |
+
$discount_price_new = $discount_price / $ware_count;
|
147 |
+
$markup_price_new = $markup_price / $ware_count;
|
148 |
+
foreach ($ware_array as $key => $value) {
|
149 |
+
//$start = 1;
|
150 |
+
$pro_item = '';
|
151 |
+
$pro_names = '';
|
152 |
+
foreach ($value as $mainarray) {
|
153 |
+
$pro_model = $mainarray;
|
154 |
+
$weight = ($pro_model['weight'] * $qtyordered);
|
155 |
+
$product_id = $mainarray['entity_id'];
|
156 |
+
$product_description = str_replace(' ', '', $mainarray['description']);
|
157 |
+
$product_name = $mainarray['name'];
|
158 |
+
$freight_length = $mainarray['freight_length'];
|
159 |
+
$freight_width = $mainarray['freight_width'];
|
160 |
+
$freight_height = $mainarray['freight_height'];
|
161 |
+
$nmfc = $mainarray['nmfc'];
|
162 |
+
// $quantity = $cart_products[$product_id];
|
163 |
+
// $weight = ($mainarray['weight'] * $quantity);
|
164 |
+
|
165 |
+
$freight_class = $f_attribute[$mainarray['freight_class']];
|
166 |
+
//$packaging_type = $m_attribute[$mainarray['packaging_type']];
|
167 |
+
$ware_id = $m1_attribute[$mainarray['origin_warehouse']];
|
168 |
+
|
169 |
+
$resource = Mage::getSingleton('core/resource');
|
170 |
+
$readConnection = $resource->getConnection('core_read');
|
171 |
+
$tableNamep = $resource->getTableName('brst_ship_warehouses');
|
172 |
+
$queryp = "SELECT * FROM $tableNamep WHERE short_name = '$ware_id' LIMIT 10";
|
173 |
+
|
174 |
+
$results = $readConnection->fetchAll($queryp);
|
175 |
+
//echo "<pre>";print_r($results);exit;
|
176 |
+
foreach ($results as $ware_result) {
|
177 |
+
$warehouse_name_i = $ware_result['short_name'];
|
178 |
+
$warehouse_location_type = str_replace(' ', '', $ware_result['location_type']);
|
179 |
+
$accessorials = $ware_result['accessorials'];
|
180 |
+
$accessorials = explode(',', $accessorials);
|
181 |
+
//print_r($accessorials);
|
182 |
+
$accessorialsdisplay = count($accessorials);
|
183 |
+
$print_accessorials = '';
|
184 |
+
for ($modz = 0; $modz < $accessorialsdisplay; $modz++) {
|
185 |
+
|
186 |
+
//$print_accessorials ="<p>".$accessorials[$modz]."</p>"
|
187 |
+
if ($accessorials[$modz] == '1') {
|
188 |
+
$print_accessorials .= "<string>ORIGIN_LIFT_GATE</string>";
|
189 |
+
}
|
190 |
+
if ($accessorials[$modz] == '2') {
|
191 |
+
$print_accessorials .= "<string>ORIGIN_LIMITED_PU</string>";
|
192 |
+
}
|
193 |
+
if ($accessorials[$modz] == '3') {
|
194 |
+
$print_accessorials .= "<string>ORIGIN_INSIDE_PU</string>";
|
195 |
+
}
|
196 |
+
if ($accessorials[$modz] == '4') {
|
197 |
+
$print_accessorials .= "<string>ORIGIN_CALL_FOR_APPT</string>";
|
198 |
+
}
|
199 |
+
}
|
200 |
+
//ECHO $print_accessorials;
|
201 |
+
?>
|
202 |
+
|
203 |
+
<input type="hidden" value="<?php
|
204 |
+
echo $warehouse_location_type;
|
205 |
+
?>" id="hidden_warehouse_location" />
|
206 |
+
<?php
|
207 |
+
$warehouse_postcode = $ware_result['cmpny_postcode'];
|
208 |
+
$city = $ware_result['city'];
|
209 |
+
$state = $ware_result['state'];
|
210 |
+
//$location_type = $ware_result['location_type'];
|
211 |
+
?>
|
212 |
+
<input type="hidden" value="<?php
|
213 |
+
echo $warehouse_postcode;
|
214 |
+
?>" id="warehouse_postcode" />
|
215 |
+
<?php
|
216 |
+
}
|
217 |
+
// echo $apirateurl;
|
218 |
+
$pro_names .= '<h3>' . $product_name . '</h3>';
|
219 |
+
|
220 |
+
$pro_item .= '<RatesRequest_Item>
|
221 |
+
<Description>' . $product_description . '</Description>
|
222 |
+
<PackagingCode>Palletized</PackagingCode>
|
223 |
+
<Quantity>' . $qtyordered . '</Quantity>
|
224 |
+
<LinearFeet>0</LinearFeet>
|
225 |
+
<Dimensions>
|
226 |
+
<Length>' . $freight_length . '</Length>
|
227 |
+
<Width>' . $freight_width . '</Width>
|
228 |
+
<Height>' . $freight_height . '</Height>
|
229 |
+
<UnitOfMeasure>IN</UnitOfMeasure>
|
230 |
+
</Dimensions>
|
231 |
+
<FreightClass>' . $freight_class . '</FreightClass>
|
232 |
+
<Weight>
|
233 |
+
<WeightAmt>' . $weight . '</WeightAmt>
|
234 |
+
<UnitOfMeasure>LBS</UnitOfMeasure>
|
235 |
+
</Weight>
|
236 |
+
<Nmfc>' . $nmfc . '</Nmfc>
|
237 |
+
</RatesRequest_Item>';
|
238 |
+
}
|
239 |
+
|
240 |
+
|
241 |
+
$xml = '<?xml version="1.0" encoding="utf-8"?>
|
242 |
+
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
|
243 |
+
<soap12:Body>
|
244 |
+
<GetRates xmlns="http://freightcenter.com/API/V04/">
|
245 |
+
<request>
|
246 |
+
<LicenseKey>3BDA740C-FF39-4BDC-AB49-B0A3C08E23B4</LicenseKey>
|
247 |
+
<Username>'.$freightuser.'</Username>
|
248 |
+
<Password>'.$freightpwd.'</Password>
|
249 |
+
<OriginPostalCode>' . $warehouse_postcode . '</OriginPostalCode>
|
250 |
+
<OriginLocationType>' . $warehouse_location_type . '</OriginLocationType>
|
251 |
+
<DestinationPostalCode>' . $address . '</DestinationPostalCode>
|
252 |
+
<DestinationLocationType>' . $loc_val . '</DestinationLocationType>
|
253 |
+
<Items>' . $pro_item . '</Items>
|
254 |
+
<Accessorials>' . $codes . '' . $print_accessorials . '</Accessorials>
|
255 |
+
<Filters>
|
256 |
+
<Mode>LTL</Mode>
|
257 |
+
<IncludeWhiteGlove>false</IncludeWhiteGlove>
|
258 |
+
<IncludeMotorcycleRates>false</IncludeMotorcycleRates>
|
259 |
+
<CarrierFilter>
|
260 |
+
<CarrierFilterType>INCLUDE</CarrierFilterType>
|
261 |
+
' . $carrier_multi_rate . '
|
262 |
+
</CarrierFilter>
|
263 |
+
</Filters>
|
264 |
+
</request>
|
265 |
+
</GetRates>
|
266 |
+
</soap12:Body>
|
267 |
+
</soap12:Envelope>';
|
268 |
+
$apiurl = $apirateurl;
|
269 |
+
// print_r($xml);
|
270 |
+
$headers = array(
|
271 |
+
"POST /V04/rates.asmx HTTP/1.1",
|
272 |
+
"Host: " . $host . "",
|
273 |
+
"Content-Type: text/xml; charset=utf-8",
|
274 |
+
"Content-length: " . strlen($xml)
|
275 |
+
);
|
276 |
+
//print_R($xml);
|
277 |
+
/* send curl request to get active carriers */
|
278 |
+
$soap_do = curl_init();
|
279 |
+
curl_setopt($soap_do, CURLOPT_URL, $apiurl);
|
280 |
+
curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true);
|
281 |
+
curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false);
|
282 |
+
curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false);
|
283 |
+
curl_setopt($soap_do, CURLOPT_POST, true);
|
284 |
+
curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 0);
|
285 |
+
curl_setopt($soap_do, CURLOPT_TIMEOUT, 400);
|
286 |
+
curl_setopt($soap_do, CURLOPT_HTTPHEADER, $headers);
|
287 |
+
curl_setopt($soap_do, CURLOPT_POSTFIELDS, $xml);
|
288 |
+
|
289 |
+
$result = curl_exec($soap_do);
|
290 |
+
|
291 |
+
curl_close($soap_do);
|
292 |
+
|
293 |
+
$p = xml_parser_create();
|
294 |
+
xml_parse_into_struct($p, $result, $vals, $index);
|
295 |
+
xml_parser_free($p);
|
296 |
+
//echo '<pre>'; print_r($vals);echo '</pre>';
|
297 |
+
$vals['5']['value'];
|
298 |
+
if ($vals['5']['value'] == 'ERROR') {
|
299 |
+
} else if ($vals['5']['value'] == 'WARNING') {
|
300 |
+
} else if (empty($vals)) {
|
301 |
+
}
|
302 |
+
|
303 |
+
else {
|
304 |
+
$xmlResponseArray = array();
|
305 |
+
foreach ($vals as $charges) {
|
306 |
+
|
307 |
+
if (in_array("TOTALCHARGE", $charges)) {
|
308 |
+
$xmlResponseArray['TOTALCHARGE'][] = $charges['value'];
|
309 |
+
}
|
310 |
+
if (in_array("SERVICENAME", $charges)) {
|
311 |
+
$xmlResponseArray['SERVICENAME'][] = $charges['value'];
|
312 |
+
}
|
313 |
+
if (in_array("SERVICEDAYS", $charges)) {
|
314 |
+
$xmlResponseArray['SERVICEDAYS'][] = $charges['value'];
|
315 |
+
}
|
316 |
+
if (in_array("RATEID", $charges)) {
|
317 |
+
$xmlResponseArray['RATEID'][] = $charges['value'];
|
318 |
+
}
|
319 |
+
}
|
320 |
+
//echo '<pre>';print_r($xmlResponseArray);
|
321 |
+
$xmlResponse = array();
|
322 |
+
$countedCharges = count($xmlResponseArray['TOTALCHARGE']);
|
323 |
+
for ($j = 0; $j <= $Carrierdisplay; $j++) {
|
324 |
+
$xmlResponse[$j][] = $xmlResponseArray['TOTALCHARGE'][$j];
|
325 |
+
$xmlResponse[$j][] = $xmlResponseArray['SERVICENAME'][$j];
|
326 |
+
$xmlResponse[$j][] = $xmlResponseArray['SERVICEDAYS'][$j];
|
327 |
+
$xmlResponse[$j][] = $xmlResponseArray['RATEID'][$j];
|
328 |
+
|
329 |
+
}
|
330 |
+
|
331 |
+
|
332 |
+
// echo '<pre>'; print_r($xmlResponse); echo '</pre>';
|
333 |
+
$total_chargeArr = array();
|
334 |
+
$carriers_value = array();
|
335 |
+
$RATEID = array();
|
336 |
+
$business_day = array();
|
337 |
+
$business = array();
|
338 |
+
foreach ($xmlResponse as $xmlResponse2) {
|
339 |
+
//echo $xmlResponse2[0];
|
340 |
+
$total_chargeArr[] = $xmlResponse2[0];
|
341 |
+
//$myPrice = $total_charge + $myPrice;
|
342 |
+
$carriers_value[] = $xmlResponse2[1];
|
343 |
+
$business_day[] = $xmlResponse2[2];
|
344 |
+
$business[] = $xmlResponse2[2];
|
345 |
+
$newArray[] = $business_day;
|
346 |
+
$business_day = array();
|
347 |
+
$RATEID[] = $xmlResponse2[3];
|
348 |
+
//
|
349 |
+
}
|
350 |
+
$days = array();
|
351 |
+
foreach ($newArray as $ayy) {
|
352 |
+
//print_r(array_filter($ayy));
|
353 |
+
$days[] = max($ayy);
|
354 |
+
//echo '</br>';
|
355 |
+
}
|
356 |
+
$bussi = array_filter($days);
|
357 |
+
$day = max($bussi);
|
358 |
+
//echo '<pre>'; print_r(array_filter($days)); echo '</pre>';
|
359 |
+
$total_charge = $total_chargeArr[0];
|
360 |
+
$carriers_value = $carriers_value[0];
|
361 |
+
$business = $business[0];
|
362 |
+
$RATEID = $RATEID[0];
|
363 |
+
$business_day = $business_day[0];
|
364 |
+
//$myPrice = $getprice + $myPrice;
|
365 |
+
//$myPrice = $total_charge + $myPrice;
|
366 |
+
|
367 |
+
$resource = Mage::getSingleton('core/resource');
|
368 |
+
$writeConnection = $resource->getConnection('core_write');
|
369 |
+
/* $tableNamep = $resource->getTableName('brst_freight_shipping');
|
370 |
+
$query = "INSERT INTO ".$tableNamep." (quote_id,product_id,shipping_charge,carrier_name,final_dest,rateid, warehouse_name) VALUES ('$quote_id','$product_id','$total_charge','$carriers_value','$loc_val','$RATEID','$warehouse_name_i')";
|
371 |
+
$writeConnection->query($query); */
|
372 |
+
|
373 |
+
$tableNamep = $resource->getTableName('brst_freight_shipping');
|
374 |
+
$select = "Select * from $tableNamep where product_id='$product_id' AND quote_id='$quote_id'";
|
375 |
+
$qry = $writeConnection->query($select);
|
376 |
+
$product_info = $qry->fetchAll();
|
377 |
+
//echo "<pre>";print_r($product_info);exit;
|
378 |
+
|
379 |
+
|
380 |
+
|
381 |
+
if ($markup == 'none') {
|
382 |
+
if ($product_info == NULL) {
|
383 |
+
|
384 |
+
if ($subtotal > $discount_amount) {
|
385 |
+
if ($total_charge < $discount_price_new) {
|
386 |
+
|
387 |
+
$query = "INSERT INTO " . $tableNamep . " (quote_id,product_id,shipping_charge,carrier_name,final_dest,rateid, warehouse_name, days,grandship) VALUES ('$quote_id','$product_id','$total_charge','$carriers_value','$loc_val','$RATEID','$warehouse_name_i', '$business','$total_charge')";
|
388 |
+
} else {
|
389 |
+
//$total_charge = $discount_price_new;
|
390 |
+
|
391 |
+
$query = "INSERT INTO " . $tableNamep . " (quote_id,product_id,shipping_charge,carrier_name,final_dest,rateid, warehouse_name, days,grandship) VALUES ('$quote_id','$product_id','$discount_price_new','$carriers_value','$loc_val','$RATEID','$warehouse_name_i', '$business','$total_charge')";
|
392 |
+
}
|
393 |
+
|
394 |
+
} else {
|
395 |
+
$query = "INSERT INTO " . $tableNamep . " (quote_id,product_id,shipping_charge,carrier_name,final_dest,rateid, warehouse_name, days,grandship) VALUES ('$quote_id','$product_id','$total_charge','$carriers_value','$loc_val','$RATEID','$warehouse_name_i', '$business','$total_charge')";
|
396 |
+
|
397 |
+
}
|
398 |
+
$writeConnection->query($query);
|
399 |
+
} else {
|
400 |
+
$rowid = $product_info[0]['id'];
|
401 |
+
if ($subtotal > $discount_amount) {
|
402 |
+
if ($total_charge < $discount_price_new) {
|
403 |
+
|
404 |
+
$query = "UPDATE `$tableNamep` SET shipping_charge='$discount_price_new',carrier_name='$carriers_value', final_dest='$loc_val',rateid='$RATEID', days = '$business' ,grandship = '$total_charge' where id=$rowid";
|
405 |
+
} else {
|
406 |
+
|
407 |
+
//$total_charge = $discount_price_new;
|
408 |
+
$query = "UPDATE `$tableNamep` SET shipping_charge='$discount_price_new',carrier_name='$carriers_value', final_dest='$loc_val',rateid='$RATEID', days = '$business',grandship = '$total_charge' where id=$rowid";
|
409 |
+
}
|
410 |
+
|
411 |
+
} else {
|
412 |
+
|
413 |
+
$query = "UPDATE `$tableNamep` SET shipping_charge='$total_charge',carrier_name='$carriers_value', final_dest='$loc_val',rateid='$RATEID', days = '$business' ,grandship = '$total_charge' where id=$rowid";
|
414 |
+
}
|
415 |
+
$writeConnection->query($query);
|
416 |
+
}
|
417 |
+
|
418 |
+
|
419 |
+
}
|
420 |
+
if ($markup == 'markup') {
|
421 |
+
|
422 |
+
if ($product_info == NULL) {
|
423 |
+
|
424 |
+
if ($markup_type == 'percent') {
|
425 |
+
$markup_price_new = Mage::getStoreConfig('carriers/freightcenter/markup_price');
|
426 |
+
$gettotal_pr = ($total_charge * $markup_price_new) / 100;
|
427 |
+
$gettotal_q = $total_charge + $gettotal_pr;
|
428 |
+
} else {
|
429 |
+
$gettotal_q = $total_charge + $markup_price_new;
|
430 |
+
}
|
431 |
+
|
432 |
+
|
433 |
+
if ($subtotal > $discount_amount) {
|
434 |
+
if ($gettotal_q < $discount_price_new) {
|
435 |
+
|
436 |
+
$query = "INSERT INTO " . $tableNamep . " (quote_id,product_id,shipping_charge,carrier_name,final_dest,rateid, warehouse_name, days,grandship) VALUES ('$quote_id','$product_id','$gettotal_q','$carriers_value','$loc_val','$RATEID','$warehouse_name_i', '$business', '$total_charge')";
|
437 |
+
} else {
|
438 |
+
//$total_charge = $discount_price_new;
|
439 |
+
|
440 |
+
$query = "INSERT INTO " . $tableNamep . " (quote_id,product_id,shipping_charge,carrier_name,final_dest,rateid, warehouse_name, days,grandship) VALUES ('$quote_id','$product_id','$discount_price_new','$carriers_value','$loc_val','$RATEID','$warehouse_name_i', '$business', '$total_charge')";
|
441 |
+
}
|
442 |
+
|
443 |
+
} else {
|
444 |
+
|
445 |
+
$query = "INSERT INTO " . $tableNamep . " (quote_id,product_id,shipping_charge,carrier_name,final_dest,rateid, warehouse_name, days,grandship) VALUES ('$quote_id','$product_id','$gettotal_q','$carriers_value','$loc_val','$RATEID','$warehouse_name_i', '$business', '$total_charge')";
|
446 |
+
|
447 |
+
}
|
448 |
+
$writeConnection->query($query);
|
449 |
+
} else {
|
450 |
+
$rowid = $product_info[0]['id'];
|
451 |
+
if ($markup_type == 'percent') {
|
452 |
+
$markup_price_new = Mage::getStoreConfig('carriers/freightcenter/markup_price');
|
453 |
+
$gettotal_pr = ($total_charge * $markup_price_new) / 100;
|
454 |
+
$gettotal_q = $total_charge + $gettotal_pr;
|
455 |
+
} else {
|
456 |
+
$gettotal_q = $total_charge + $markup_price_new;
|
457 |
+
}
|
458 |
+
if ($subtotal > $discount_amount) {
|
459 |
+
if ($gettotal_q < $discount_price_new) {
|
460 |
+
|
461 |
+
$query = "UPDATE `$tableNamep` SET shipping_charge='$gettotal_q',carrier_name='$carriers_value', final_dest='$loc_val',rateid='$RATEID', days = '$business',grandship = '$total_charge' where id=$rowid";
|
462 |
+
} else {
|
463 |
+
//$total_charge = $discount_price_new;
|
464 |
+
$query = "UPDATE `$tableNamep` SET shipping_charge='$discount_price_new',carrier_name='$carriers_value', final_dest='$loc_val',rateid='$RATEID', days = '$business',grandship = '$total_charge' where id=$rowid";
|
465 |
+
}
|
466 |
+
|
467 |
+
} else {
|
468 |
+
if ($gettotal_q < $discount_price_new) {
|
469 |
+
|
470 |
+
$query = "UPDATE `$tableNamep` SET shipping_charge='$gettotal_q',carrier_name='$carriers_value', final_dest='$loc_val',rateid='$RATEID', days = '$business',grandship = '$total_charge' where id=$rowid";
|
471 |
+
} else {
|
472 |
+
$query = "UPDATE `$tableNamep` SET shipping_charge='$discount_price_new',carrier_name='$carriers_value', final_dest='$loc_val',rateid='$RATEID', days = '$business',grandship = '$total_charge' where id=$rowid";
|
473 |
+
|
474 |
+
}
|
475 |
+
}
|
476 |
+
$writeConnection->query($query);
|
477 |
+
}
|
478 |
+
}
|
479 |
+
|
480 |
+
if ($markup == 'discount') {
|
481 |
+
if ($markup_type == 'percent') {
|
482 |
+
$markup_price_new = Mage::getStoreConfig('carriers/freightcenter/markup_price');
|
483 |
+
$gettotal_pr = ($total_charge * $markup_price_new) / 100;
|
484 |
+
$gettotal_q = $total_charge - $gettotal_pr;
|
485 |
+
|
486 |
+
} else {
|
487 |
+
$gettotal_q = $total_charge - $markup_price_new;
|
488 |
+
|
489 |
+
}
|
490 |
+
|
491 |
+
if ($product_info == NULL) {
|
492 |
+
|
493 |
+
|
494 |
+
if ($subtotal > $discount_amount) {
|
495 |
+
if ($gettotal_q < $discount_price_new) {
|
496 |
+
|
497 |
+
$query = "INSERT INTO " . $tableNamep . " (quote_id,product_id,shipping_charge,carrier_name,final_dest,rateid, warehouse_name, days,grandship) VALUES ('$quote_id','$product_id','$gettotal_q','$carriers_value','$loc_val','$RATEID','$warehouse_name_i', '$business', '$total_charge')";
|
498 |
+
} else {
|
499 |
+
//$total_charge = $discount_price_new;
|
500 |
+
|
501 |
+
$query = "INSERT INTO " . $tableNamep . " (quote_id,product_id,shipping_charge,carrier_name,final_dest,rateid, warehouse_name, days,grandship) VALUES ('$quote_id','$product_id','$discount_price_new','$carriers_value','$loc_val','$RATEID','$warehouse_name_i', '$business', '$total_charge')";
|
502 |
+
}
|
503 |
+
|
504 |
+
} else {
|
505 |
+
$query = "INSERT INTO " . $tableNamep . " (quote_id,product_id,shipping_charge,carrier_name,final_dest,rateid, warehouse_name, days,grandship) VALUES ('$quote_id','$product_id','$gettotal_q','$carriers_value','$loc_val','$RATEID','$warehouse_name_i', '$business', '$total_charge')";
|
506 |
+
|
507 |
+
}
|
508 |
+
$writeConnection->query($query);
|
509 |
+
} else {
|
510 |
+
if ($markup_type == 'percent') {
|
511 |
+
$markup_price_new = Mage::getStoreConfig('carriers/freightcenter/markup_price');
|
512 |
+
$gettotal_pr = ($total_charge * $markup_price_new) / 100;
|
513 |
+
$gettotal_q = $total_charge + $gettotal_pr;
|
514 |
+
} else {
|
515 |
+
$gettotal_q = $total_charge + $markup_price_new;
|
516 |
+
}
|
517 |
+
|
518 |
+
$rowid = $product_info[0]['id'];
|
519 |
+
if ($subtotal > $discount_amount) {
|
520 |
+
if ($gettotal_q < $discount_price_new) {
|
521 |
+
|
522 |
+
$query = "UPDATE `$tableNamep` SET shipping_charge='$gettotal_q',carrier_name='$carriers_value', final_dest='$loc_val',rateid='$RATEID', days = '$business',grandship = '$total_charge' where id=$rowid";
|
523 |
+
} else {
|
524 |
+
|
525 |
+
//$total_charge = $discount_price_new;
|
526 |
+
$query = "UPDATE `$tableNamep` SET shipping_charge='$discount_price_new',carrier_name='$carriers_value', final_dest='$loc_val',rateid='$RATEID', days = '$business',grandship = '$total_charge' where id=$rowid";
|
527 |
+
}
|
528 |
+
|
529 |
+
} else {
|
530 |
+
|
531 |
+
$query = "UPDATE `$tableNamep` SET shipping_charge='$gettotal_q',carrier_name='$carriers_value', final_dest='$loc_val',rateid='$RATEID', days = '$business',grandship = '$total_charge' where id=$rowid";
|
532 |
+
}
|
533 |
+
$writeConnection->query($query);
|
534 |
+
}
|
535 |
+
|
536 |
+
}
|
537 |
+
$myPrice = $total_charge + $myPrice;
|
538 |
+
}
|
539 |
+
}
|
540 |
+
/* $resource = Mage::getSingleton('core/resource');
|
541 |
+
$writeConnection = $resource->getConnection('core_write');
|
542 |
+
$tableNamep = $resource->getTableName('brst_freight_shipping');
|
543 |
+
$query = "INSERT INTO ".$tableNamep." (quote_id,product_id,shipping_charge,carrier_name,final_dest,rateid) VALUES ('$quote_id','$product_id','$total_charge','$carriers_value','$loc_val','$RATEID')";
|
544 |
+
$writeConnection->query($query); */
|
545 |
+
// $myPrice;
|
546 |
+
//echo $myPrice;
|
547 |
+
if ($vals['5']['value'] == 'ERROR') {
|
548 |
+
?>
|
549 |
+
<div>
|
550 |
+
<p> There was a problem with the freight. Do you want to check-out with only non-freight products? </p>
|
551 |
+
<button onclick="removefreight('yes')" class="button" title="Remove Freight Products" type="button"><span><span>Yes</span></span></button>
|
552 |
+
</div>
|
553 |
+
<?php
|
554 |
+
} else if ($vals['5']['value'] == 'WARNING') {
|
555 |
+
?>
|
556 |
+
There was a problem with the freight. Do you want to check-out with only non-freight products?
|
557 |
+
</p>
|
558 |
+
<button onclick="removefreight('yes')" class="button" title="Remove Freight Products" type="button"><span><span>Yes</span></span></button>
|
559 |
+
</div>
|
560 |
+
<?php
|
561 |
+
}
|
562 |
+
|
563 |
+
else if (empty($vals)) {
|
564 |
+
?>
|
565 |
+
There was a problem with the freight. Do you want to check-out with only non-freight products?
|
566 |
+
</p>
|
567 |
+
<button onclick="removefreight('yes')" class="button" title="Remove Freight Products" type="button"><span><span>Yes</span></span></button>
|
568 |
+
</div>
|
569 |
+
<?php
|
570 |
+
} else {
|
571 |
+
|
572 |
+
if ($markup == 'none') {
|
573 |
+
$gettotal = $myPrice;
|
574 |
+
/* if($subtotal > $discount_amount){
|
575 |
+
if($gettotal < $discount_price){
|
576 |
+
$gettotal;
|
577 |
+
} else{
|
578 |
+
$gettotal = $discount_price;
|
579 |
+
}
|
580 |
+
}
|
581 |
+
else{
|
582 |
+
$gettotal;
|
583 |
+
} */
|
584 |
+
}
|
585 |
+
if ($markup == 'markup') {
|
586 |
+
if ($markup_type == 'percent') {
|
587 |
+
$gettotal_pr = ($myPrice * $markup_price) / 100;
|
588 |
+
$gettotal = $myPrice + $gettotal_pr;
|
589 |
+
/* if($subtotal > $discount_amount){
|
590 |
+
if($gettotal > $discount_price){
|
591 |
+
$gettotal = $discount_price;
|
592 |
+
}
|
593 |
+
} */
|
594 |
+
} else {
|
595 |
+
$gettotal = $myPrice + $markup_price;
|
596 |
+
/* if($subtotal > $discount_amount){
|
597 |
+
if($gettotal > $discount_price){
|
598 |
+
$gettotal = $discount_price;
|
599 |
+
}
|
600 |
+
} */
|
601 |
+
}
|
602 |
+
}
|
603 |
+
|
604 |
+
if ($markup == 'discount') {
|
605 |
+
|
606 |
+
if ($markup_type == 'percent') {
|
607 |
+
$gettotal_pr = ($myPrice * $markup_price) / 100;
|
608 |
+
$gettotal = $myPrice - $gettotal_pr;
|
609 |
+
/* if($subtotal > $discount_amount){
|
610 |
+
if($gettotal > $discount_price){
|
611 |
+
$gettotal = $discount_price;
|
612 |
+
}
|
613 |
+
} */
|
614 |
+
} else {
|
615 |
+
$gettotal = $myPrice - $markup_price;
|
616 |
+
/* if($subtotal > $discount_amount){
|
617 |
+
if($gettotal > $discount_price){
|
618 |
+
$gettotal = $discount_price;
|
619 |
+
}
|
620 |
+
} */
|
621 |
+
}
|
622 |
+
}
|
623 |
+
|
624 |
+
|
625 |
+
if ($subtotal > $discount_amount) {
|
626 |
+
if ($gettotal > $discount_price) {
|
627 |
+
$gettotal_add = $discount_price;
|
628 |
+
} else {
|
629 |
+
$gettotal_add = $gettotal;
|
630 |
+
}
|
631 |
+
} else {
|
632 |
+
$gettotal_add = $gettotal;
|
633 |
+
}
|
634 |
+
?>
|
635 |
+
<div style="clear:both;height:16px;"></div>
|
636 |
+
<div class="ajax-result" id="ajax_result">
|
637 |
+
<table><tr><td width="20">
|
638 |
+
<input style="float: left;" type="radio" class="ajax" value="ajax_response" name="shipping<?php
|
639 |
+
print $product_id;
|
640 |
+
?>" onclick="ajaxcallnew_no('<?php
|
641 |
+
print $product_id;
|
642 |
+
?>','<?php
|
643 |
+
print $gettotal_add;
|
644 |
+
?>','<?php
|
645 |
+
echo $quote_id;
|
646 |
+
?>','<?php
|
647 |
+
echo $carriers_value;
|
648 |
+
?>','<?php
|
649 |
+
echo $RATEID;
|
650 |
+
?>');" id="ajax<?php
|
651 |
+
print $product_id;
|
652 |
+
?>" />
|
653 |
+
</td><td>
|
654 |
+
<div> <span for="ajax<?php
|
655 |
+
print $product_id;
|
656 |
+
?>"> Estimated Transit Time: <?php
|
657 |
+
echo $day;
|
658 |
+
?> Business days </span> </div>
|
659 |
+
<?php
|
660 |
+
if ($markup == 'none') {
|
661 |
+
|
662 |
+
if ($gettotal > $gettotal_add) {
|
663 |
+
?>
|
664 |
+
Cost: $<?php
|
665 |
+
|
666 |
+
|
667 |
+
echo $gettotal = number_format($gettotal, 2, '.', ',');
|
668 |
+
?>
|
669 |
+
</br>
|
670 |
+
Discount: -$<?php
|
671 |
+
|
672 |
+
$discount_get = $gettotal - $discount_price;
|
673 |
+
echo $discount_get = number_format($discount_get, 2, '.', ',');
|
674 |
+
|
675 |
+
?>
|
676 |
+
</br>
|
677 |
+
<?php
|
678 |
+
}
|
679 |
+
}
|
680 |
+
?>
|
681 |
+
<?php
|
682 |
+
if ($markup == 'markup') {
|
683 |
+
// $gettot= number_format($gettotal, 2, '.', '');
|
684 |
+
//echo $gettotal_add;
|
685 |
+
if ($gettotal > $gettotal_add) {
|
686 |
+
?>
|
687 |
+
Cost: $<?php
|
688 |
+
echo $getto = number_format($gettotal, 2, '.', ',');
|
689 |
+
?>
|
690 |
+
</br>
|
691 |
+
Discount: -$<?php
|
692 |
+
|
693 |
+
$discount_get = $gettotal - $discount_price;
|
694 |
+
echo $discount_get = number_format($discount_get, 2, '.', ',');
|
695 |
+
|
696 |
+
?>
|
697 |
+
</br>
|
698 |
+
<?php
|
699 |
+
}
|
700 |
+
}
|
701 |
+
?>
|
702 |
+
<?php
|
703 |
+
if ($markup == 'discount') {
|
704 |
+
if ($myPrice > $gettotal_add) {
|
705 |
+
?>
|
706 |
+
Cost: $<?php
|
707 |
+
|
708 |
+
|
709 |
+
echo $myPr = number_format($myPrice, 2, '.', ',');
|
710 |
+
?>
|
711 |
+
</br>
|
712 |
+
Discount: -$<?php
|
713 |
+
|
714 |
+
$discount_get = $myPrice - $gettotal_add;
|
715 |
+
echo $discount_get = number_format($discount_get, 2, '.', ',');
|
716 |
+
|
717 |
+
?>
|
718 |
+
</br>
|
719 |
+
<?php
|
720 |
+
}
|
721 |
+
}
|
722 |
+
?>
|
723 |
+
You Pay: $<?php
|
724 |
+
echo $gettotal_a = number_format($gettotal_add, 2, '.', ',');
|
725 |
+
?>
|
726 |
+
</td></tr></table>
|
727 |
+
</div>
|
728 |
+
<?php
|
729 |
+
}
|
730 |
+
|
731 |
+
?>
|
app/code/local/Excellence/Fee/Block/Sales/Order/Total.php
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Excellence_Fee_Block_Sales_Order_Total extends Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Get label cell tag properties
|
6 |
+
*
|
7 |
+
* @return string
|
8 |
+
*/
|
9 |
+
public function getLabelProperties()
|
10 |
+
{
|
11 |
+
return $this->getParentBlock()->getLabelProperties();
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Get order store object
|
16 |
+
*
|
17 |
+
* @return Mage_Sales_Model_Order
|
18 |
+
*/
|
19 |
+
public function getOrder()
|
20 |
+
{
|
21 |
+
return $this->getParentBlock()->getOrder();
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Get totals source object
|
26 |
+
*
|
27 |
+
* @return Mage_Sales_Model_Order
|
28 |
+
*/
|
29 |
+
public function getSource()
|
30 |
+
{
|
31 |
+
return $this->getParentBlock()->getSource();
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Get value cell tag properties
|
36 |
+
*
|
37 |
+
* @return string
|
38 |
+
*/
|
39 |
+
public function getValueProperties()
|
40 |
+
{
|
41 |
+
return $this->getParentBlock()->getValueProperties();
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Initialize reward points totals
|
46 |
+
*
|
47 |
+
* @return Enterprise_Reward_Block_Sales_Order_Total
|
48 |
+
*/
|
49 |
+
public function initTotals()
|
50 |
+
{
|
51 |
+
if ((float) $this->getOrder()->getBaseFeeAmount()) {
|
52 |
+
$source = $this->getSource();
|
53 |
+
$value = $source->getFeeAmount();
|
54 |
+
|
55 |
+
$this->getParentBlock()->addTotal(new Varien_Object(array(
|
56 |
+
'code' => 'fee',
|
57 |
+
'strong' => false,
|
58 |
+
'label' => Mage::helper('fee')->formatFee($value),
|
59 |
+
'value' => $source instanceof Mage_Sales_Model_Order_Creditmemo ? - $value : $value
|
60 |
+
)));
|
61 |
+
}
|
62 |
+
|
63 |
+
return $this;
|
64 |
+
}
|
65 |
+
}
|
app/code/local/Excellence/Fee/Helper/Data.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Excellence_Fee_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
public function formatFee($amount){
|
6 |
+
return Mage::helper('fee')->__('Freight Charges & Handling ');
|
7 |
+
}
|
8 |
+
}
|
app/code/local/Excellence/Fee/Model/Fee.php
ADDED
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Excellence_Fee_Model_Fee extends Varien_Object{
|
3 |
+
//const FEE_AMOUNT = 10;
|
4 |
+
|
5 |
+
public static function getFee(){
|
6 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
7 |
+
$session = Mage::getSingleton('checkout/session');
|
8 |
+
$quoteid = $session->getQuoteId();
|
9 |
+
|
10 |
+
$items = Mage::getSingleton('checkout/session')->getQuote()->getAllItems();
|
11 |
+
$gettotal = '';
|
12 |
+
foreach($items as $item) {
|
13 |
+
$getqty = $item->getQty();
|
14 |
+
$getid = $item->getProductId();
|
15 |
+
|
16 |
+
$select = "Select * from `brst_freight_shipping` where quote_id='$quoteid' AND product_id='$getid' AND mark = '1'";
|
17 |
+
$getselect = $connection->query($select);
|
18 |
+
$pro_data = $getselect->fetchAll();
|
19 |
+
if($pro_data != NULL) {
|
20 |
+
$getprice = $pro_data[0]['shipping_charge'];
|
21 |
+
$gettotal += ($getprice);
|
22 |
+
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
}
|
27 |
+
}
|
28 |
+
//echo $gettotal; die('here');
|
29 |
+
/* $MarkupType = Mage::getStoreConfig('carriers/freightcenter/markup_type');
|
30 |
+
$MarkupPrice = Mage::getStoreConfig('carriers/freightcenter/markup_price');
|
31 |
+
$Markuptypeadd = Mage::getStoreConfig('carriers/freightcenter/markup');
|
32 |
+
$Discount = Mage::getStoreConfig('carriers/freightcenter/discount');
|
33 |
+
$DiscountAmount = Mage::getStoreConfig('carriers/freightcenter/discount_amount');
|
34 |
+
$DiscountPrice = Mage::getStoreConfig('carriers/freightcenter/discount_price');
|
35 |
+
|
36 |
+
if($Markuptypeadd == 'markup'){
|
37 |
+
if($MarkupType == 'percent'){
|
38 |
+
$gettotal_pr = ($gettotal * $MarkupPrice)/100;
|
39 |
+
$gettotal = $gettotal + $gettotal_pr;
|
40 |
+
}
|
41 |
+
else{
|
42 |
+
$gettotal = $gettotal + $MarkupPrice ;
|
43 |
+
}
|
44 |
+
}
|
45 |
+
if($Markuptypeadd == 'none'){
|
46 |
+
if($MarkupType == 'percent'){
|
47 |
+
// $gettotal_pr = ($shipping_charge * $MarkupPrice)/100;
|
48 |
+
$gettotal = $gettotal;
|
49 |
+
}
|
50 |
+
else{
|
51 |
+
$gettotal = $gettotal;
|
52 |
+
}
|
53 |
+
}
|
54 |
+
if($Markuptypeadd == 'discount'){
|
55 |
+
if($MarkupType == 'percent'){
|
56 |
+
$gettotal_pr = ($gettotal * $MarkupPrice)/100;
|
57 |
+
$gettotal = $gettotal - $gettotal_pr;
|
58 |
+
}
|
59 |
+
else{
|
60 |
+
$gettotal = $gettotal - $MarkupPrice ;
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
if($Discount == '1'){
|
65 |
+
if($gettotal > $DiscountAmount) {
|
66 |
+
$gettotal = $gettotal - $DiscountPrice;
|
67 |
+
|
68 |
+
}
|
69 |
+
} */
|
70 |
+
|
71 |
+
return $gettotal;
|
72 |
+
}
|
73 |
+
|
74 |
+
|
75 |
+
public static function canApply($address){
|
76 |
+
|
77 |
+
$order = Mage::getModel("sales/order")->load(1);
|
78 |
+
$count = count($order);
|
79 |
+
if($count < 0){
|
80 |
+
//put here your business logic to check if fee should be applied or not
|
81 |
+
if($address->getAddressType() == 'billing'){
|
82 |
+
return true;
|
83 |
+
}
|
84 |
+
}
|
85 |
+
else{
|
86 |
+
//if($address->getAddressType() == 'billing'){
|
87 |
+
return true;
|
88 |
+
//}
|
89 |
+
|
90 |
+
}
|
91 |
+
}
|
92 |
+
}
|
app/code/local/Excellence/Fee/Model/Observer.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Excellence_Fee_Model_Observer{
|
3 |
+
public function invoiceSaveAfter(Varien_Event_Observer $observer)
|
4 |
+
{
|
5 |
+
$invoice = $observer->getEvent()->getInvoice();
|
6 |
+
if ($invoice->getBaseFeeAmount()) {
|
7 |
+
$order = $invoice->getOrder();
|
8 |
+
$order->setFeeAmountInvoiced($order->getFeeAmountInvoiced() + $invoice->getFeeAmount());
|
9 |
+
$order->setBaseFeeAmountInvoiced($order->getBaseFeeAmountInvoiced() + $invoice->getBaseFeeAmount());
|
10 |
+
}
|
11 |
+
return $this;
|
12 |
+
}
|
13 |
+
public function creditmemoSaveAfter(Varien_Event_Observer $observer)
|
14 |
+
{
|
15 |
+
/* @var $creditmemo Mage_Sales_Model_Order_Creditmemo */
|
16 |
+
$creditmemo = $observer->getEvent()->getCreditmemo();
|
17 |
+
if ($creditmemo->getFeeAmount()) {
|
18 |
+
$order = $creditmemo->getOrder();
|
19 |
+
$order->setFeeAmountRefunded($order->getFeeAmountRefunded() + $creditmemo->getFeeAmount());
|
20 |
+
$order->setBaseFeeAmountRefunded($order->getBaseFeeAmountRefunded() + $creditmemo->getBaseFeeAmount());
|
21 |
+
}
|
22 |
+
return $this;
|
23 |
+
}
|
24 |
+
public function updatePaypalTotal($evt){
|
25 |
+
$cart = $evt->getPaypalCart();
|
26 |
+
$cart->updateTotal(Mage_Paypal_Model_Cart::TOTAL_SUBTOTAL,$cart->getSalesEntity()->getFeeAmount());
|
27 |
+
}
|
28 |
+
}
|
app/code/local/Excellence/Fee/Model/Sales/Order/Total/Creditmemo/Fee.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Excellence_Fee_Model_Sales_Order_Total_Creditmemo_Fee extends Mage_Sales_Model_Order_Creditmemo_Total_Abstract
|
3 |
+
{
|
4 |
+
public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
|
5 |
+
{
|
6 |
+
$order = $creditmemo->getOrder();
|
7 |
+
$feeAmountLeft = $order->getFeeAmountInvoiced() - $order->getFeeAmountRefunded();
|
8 |
+
$basefeeAmountLeft = $order->getBaseFeeAmountInvoiced() - $order->getBaseFeeAmountRefunded();
|
9 |
+
if ($basefeeAmountLeft > 0) {
|
10 |
+
$creditmemo->setGrandTotal($creditmemo->getGrandTotal() + $feeAmountLeft);
|
11 |
+
$creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() + $basefeeAmountLeft);
|
12 |
+
$creditmemo->setFeeAmount($feeAmountLeft);
|
13 |
+
$creditmemo->setBaseFeeAmount($basefeeAmountLeft);
|
14 |
+
}
|
15 |
+
return $this;
|
16 |
+
}
|
17 |
+
}
|
app/code/local/Excellence/Fee/Model/Sales/Order/Total/Invoice/Fee.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Excellence_Fee_Model_Sales_Order_Total_Invoice_Fee extends Mage_Sales_Model_Order_Invoice_Total_Abstract
|
3 |
+
{
|
4 |
+
public function collect(Mage_Sales_Model_Order_Invoice $invoice)
|
5 |
+
{
|
6 |
+
$order = $invoice->getOrder();
|
7 |
+
$feeAmountLeft = $order->getFeeAmount() - $order->getFeeAmountInvoiced();
|
8 |
+
$baseFeeAmountLeft = $order->getBaseFeeAmount() - $order->getBaseFeeAmountInvoiced();
|
9 |
+
if (abs($baseFeeAmountLeft) < $invoice->getBaseGrandTotal()) {
|
10 |
+
$invoice->setGrandTotal($invoice->getGrandTotal() + $feeAmountLeft);
|
11 |
+
$invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $baseFeeAmountLeft);
|
12 |
+
} else {
|
13 |
+
$feeAmountLeft = $invoice->getGrandTotal() * -1;
|
14 |
+
$baseFeeAmountLeft = $invoice->getBaseGrandTotal() * -1;
|
15 |
+
|
16 |
+
$invoice->setGrandTotal(0);
|
17 |
+
$invoice->setBaseGrandTotal(0);
|
18 |
+
}
|
19 |
+
|
20 |
+
$invoice->setFeeAmount($feeAmountLeft);
|
21 |
+
$invoice->setBaseFeeAmount($baseFeeAmountLeft);
|
22 |
+
return $this;
|
23 |
+
}
|
24 |
+
}
|
app/code/local/Excellence/Fee/Model/Sales/Quote/Address/Total/Fee.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Excellence_Fee_Model_Sales_Quote_Address_Total_Fee extends Mage_Sales_Model_Quote_Address_Total_Abstract{
|
3 |
+
protected $_code = 'fee';
|
4 |
+
|
5 |
+
public function collect(Mage_Sales_Model_Quote_Address $address)
|
6 |
+
{
|
7 |
+
parent::collect($address);
|
8 |
+
|
9 |
+
$this->_setAmount(0);
|
10 |
+
$this->_setBaseAmount(0);
|
11 |
+
|
12 |
+
$items = $this->_getAddressItems($address);
|
13 |
+
if (!count($items)) {
|
14 |
+
return $this; //this makes only address type shipping to come through
|
15 |
+
}
|
16 |
+
|
17 |
+
|
18 |
+
$quote = $address->getQuote();
|
19 |
+
|
20 |
+
if(Excellence_Fee_Model_Fee::canApply($address)){
|
21 |
+
$exist_amount = $quote->getFeeAmount();
|
22 |
+
$fee = Excellence_Fee_Model_Fee::getFee();
|
23 |
+
$balance = $fee - $exist_amount;
|
24 |
+
// $balance = $fee;
|
25 |
+
|
26 |
+
//$this->_setAmount($balance);
|
27 |
+
//$this->_setBaseAmount($balance);
|
28 |
+
|
29 |
+
$address->setFeeAmount($balance);
|
30 |
+
$address->setBaseFeeAmount($balance);
|
31 |
+
|
32 |
+
$quote->setFeeAmount($balance);
|
33 |
+
|
34 |
+
$address->setGrandTotal($address->getGrandTotal() + $address->getFeeAmount());
|
35 |
+
$address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getBaseFeeAmount());
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
public function fetch(Mage_Sales_Model_Quote_Address $address)
|
40 |
+
{
|
41 |
+
/*
|
42 |
+
$amt = $address->getFeeAmount();
|
43 |
+
$address->addTotal(array(
|
44 |
+
'code'=>$this->getCode(),
|
45 |
+
'title'=>Mage::helper('fee')->__('Fee'),
|
46 |
+
'value'=> $amt
|
47 |
+
));
|
48 |
+
return $this;
|
49 |
+
*
|
50 |
+
*/
|
51 |
+
}
|
52 |
+
}
|
app/code/local/Excellence/Fee/etc/config.xml
ADDED
@@ -0,0 +1,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Excellence_Fee>
|
5 |
+
<version>0.1.4</version>
|
6 |
+
</Excellence_Fee>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<fee>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Excellence_Fee</module>
|
14 |
+
<frontName>fee</frontName>
|
15 |
+
</args>
|
16 |
+
</fee>
|
17 |
+
</routers>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<fee>
|
21 |
+
<file>fee.xml</file>
|
22 |
+
</fee>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
</frontend>
|
26 |
+
<admin>
|
27 |
+
<routers>
|
28 |
+
<fee>
|
29 |
+
<use>admin</use>
|
30 |
+
<args>
|
31 |
+
<module>Excellence_Fee</module>
|
32 |
+
<frontName>fee</frontName>
|
33 |
+
</args>
|
34 |
+
</fee>
|
35 |
+
</routers>
|
36 |
+
</admin>
|
37 |
+
<adminhtml>
|
38 |
+
<layout>
|
39 |
+
<updates>
|
40 |
+
<fee>
|
41 |
+
<file>fee.xml</file>
|
42 |
+
</fee>
|
43 |
+
</updates>
|
44 |
+
</layout>
|
45 |
+
</adminhtml>
|
46 |
+
<global>
|
47 |
+
<sales>
|
48 |
+
<quote>
|
49 |
+
<totals>
|
50 |
+
<fee>
|
51 |
+
<class>fee/sales_quote_address_total_fee</class>
|
52 |
+
<renderer>fee/checkout_total</renderer>
|
53 |
+
</fee>
|
54 |
+
</totals>
|
55 |
+
</quote>
|
56 |
+
<order_invoice>
|
57 |
+
<totals>
|
58 |
+
<fee>
|
59 |
+
<class>fee/sales_order_total_invoice_fee</class>
|
60 |
+
</fee>
|
61 |
+
</totals>
|
62 |
+
</order_invoice>
|
63 |
+
<order_creditmemo>
|
64 |
+
<totals>
|
65 |
+
<fee>
|
66 |
+
<class>fee/sales_order_total_creditmemo_fee</class>
|
67 |
+
</fee>
|
68 |
+
</totals>
|
69 |
+
</order_creditmemo>
|
70 |
+
</sales>
|
71 |
+
<events>
|
72 |
+
<paypal_prepare_line_items>
|
73 |
+
<observers>
|
74 |
+
<paypal_prepare_line_items>
|
75 |
+
<class>fee/observer</class>
|
76 |
+
<method>updatePaypalTotal</method>
|
77 |
+
</paypal_prepare_line_items>
|
78 |
+
</observers>
|
79 |
+
</paypal_prepare_line_items>
|
80 |
+
<sales_order_invoice_save_after>
|
81 |
+
<observers>
|
82 |
+
<sales_order_invoice_save_after>
|
83 |
+
<class>fee/observer</class>
|
84 |
+
<method>invoiceSaveAfter</method>
|
85 |
+
</sales_order_invoice_save_after>
|
86 |
+
</observers>
|
87 |
+
</sales_order_invoice_save_after>
|
88 |
+
<sales_order_creditmemo_save_after>
|
89 |
+
<observers>
|
90 |
+
<sales_order_creditmemo_save_after>
|
91 |
+
<class>fee/observer</class>
|
92 |
+
<method>creditmemoSaveAfter</method>
|
93 |
+
</sales_order_creditmemo_save_after>
|
94 |
+
</observers>
|
95 |
+
</sales_order_creditmemo_save_after>
|
96 |
+
</events>
|
97 |
+
<fieldsets>
|
98 |
+
<sales_convert_quote_address>
|
99 |
+
<fee_amount><to_order>*</to_order></fee_amount>
|
100 |
+
<base_fee_amount><to_order>*</to_order></base_fee_amount>
|
101 |
+
</sales_convert_quote_address>
|
102 |
+
</fieldsets>
|
103 |
+
<pdf>
|
104 |
+
<totals>
|
105 |
+
<fee translate="title">
|
106 |
+
<title>Fee</title>
|
107 |
+
<source_field>fee_amount</source_field>
|
108 |
+
<font_size>7</font_size>
|
109 |
+
<display_zero>0</display_zero>
|
110 |
+
<sort_order>650</sort_order>
|
111 |
+
<amount_prefix>-</amount_prefix>
|
112 |
+
</fee>
|
113 |
+
</totals>
|
114 |
+
</pdf>
|
115 |
+
<models>
|
116 |
+
<fee>
|
117 |
+
<class>Excellence_Fee_Model</class>
|
118 |
+
<resourceModel>fee_mysql4</resourceModel>
|
119 |
+
</fee>
|
120 |
+
<fee_mysql4>
|
121 |
+
<class>Excellence_Fee_Model_Mysql4</class>
|
122 |
+
<entities>
|
123 |
+
<fee>
|
124 |
+
<table>fee</table>
|
125 |
+
</fee>
|
126 |
+
</entities>
|
127 |
+
</fee_mysql4>
|
128 |
+
</models>
|
129 |
+
<resources>
|
130 |
+
<fee_setup>
|
131 |
+
<setup>
|
132 |
+
<module>Excellence_Fee</module>
|
133 |
+
</setup>
|
134 |
+
<connection>
|
135 |
+
<use>core_setup</use>
|
136 |
+
</connection>
|
137 |
+
</fee_setup>
|
138 |
+
<fee_write>
|
139 |
+
<connection>
|
140 |
+
<use>core_write</use>
|
141 |
+
</connection>
|
142 |
+
</fee_write>
|
143 |
+
<fee_read>
|
144 |
+
<connection>
|
145 |
+
<use>core_read</use>
|
146 |
+
</connection>
|
147 |
+
</fee_read>
|
148 |
+
</resources>
|
149 |
+
<blocks>
|
150 |
+
<fee>
|
151 |
+
<class>Excellence_Fee_Block</class>
|
152 |
+
</fee>
|
153 |
+
</blocks>
|
154 |
+
<helpers>
|
155 |
+
<fee>
|
156 |
+
<class>Excellence_Fee_Helper</class>
|
157 |
+
</fee>
|
158 |
+
</helpers>
|
159 |
+
</global>
|
160 |
+
<default>
|
161 |
+
<sales>
|
162 |
+
<totals_sort>
|
163 |
+
<fee>15</fee>
|
164 |
+
</totals_sort>
|
165 |
+
</sales>
|
166 |
+
</default>
|
167 |
+
</config>
|
app/code/local/Excellence/Fee/sql/fee_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
|
9 |
+
ALTER TABLE `".$this->getTable('sales/order')."` ADD `fee_amount` DECIMAL( 10, 2 ) NOT NULL;
|
10 |
+
ALTER TABLE `".$this->getTable('sales/order')."` ADD `base_fee_amount` DECIMAL( 10, 2 ) NOT NULL;
|
11 |
+
|
12 |
+
");
|
13 |
+
|
14 |
+
$installer->endSetup();
|
app/code/local/Excellence/Fee/sql/fee_setup/mysql4-upgrade-0.1.0-0.1.1.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
|
9 |
+
ALTER TABLE `".$this->getTable('sales/quote_address')."` ADD `fee_amount` DECIMAL( 10, 2 ) NOT NULL;
|
10 |
+
ALTER TABLE `".$this->getTable('sales/quote_address')."` ADD `base_fee_amount` DECIMAL( 10, 2 ) NOT NULL;
|
11 |
+
|
12 |
+
");
|
13 |
+
|
14 |
+
$installer->endSetup();
|
app/code/local/Excellence/Fee/sql/fee_setup/mysql4-upgrade-0.1.1-0.1.2.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
|
9 |
+
ALTER TABLE `".$this->getTable('sales/order')."` ADD `fee_amount_invoiced` DECIMAL( 10, 2 ) NOT NULL;
|
10 |
+
ALTER TABLE `".$this->getTable('sales/order')."` ADD `base_fee_amount_invoiced` DECIMAL( 10, 2 ) NOT NULL;
|
11 |
+
|
12 |
+
");
|
13 |
+
|
14 |
+
$installer->endSetup();
|
app/code/local/Excellence/Fee/sql/fee_setup/mysql4-upgrade-0.1.2-0.1.3.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
|
9 |
+
ALTER TABLE `".$this->getTable('sales/invoice')."` ADD `fee_amount` DECIMAL( 10, 2 ) NOT NULL;
|
10 |
+
ALTER TABLE `".$this->getTable('sales/invoice')."` ADD `base_fee_amount` DECIMAL( 10, 2 ) NOT NULL;
|
11 |
+
|
12 |
+
");
|
13 |
+
|
14 |
+
$installer->endSetup();
|
app/code/local/Excellence/Fee/sql/fee_setup/mysql4-upgrade-0.1.3-0.1.4.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
|
9 |
+
ALTER TABLE `".$this->getTable('sales/order')."` ADD `fee_amount_refunded` DECIMAL( 10, 2 ) NOT NULL;
|
10 |
+
ALTER TABLE `".$this->getTable('sales/order')."` ADD `base_fee_amount_refunded` DECIMAL( 10, 2 ) NOT NULL;
|
11 |
+
|
12 |
+
ALTER TABLE `".$this->getTable('sales/creditmemo')."` ADD `fee_amount` DECIMAL( 10, 2 ) NOT NULL;
|
13 |
+
ALTER TABLE `".$this->getTable('sales/creditmemo')."` ADD `base_fee_amount` DECIMAL( 10, 2 ) NOT NULL;
|
14 |
+
|
15 |
+
");
|
16 |
+
|
17 |
+
$installer->endSetup();
|
app/code/local/Freightcenter/CustomWare/Block/Adminhtml/Collect.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Freightcenter_CustomWare_Block_Adminhtml_Collect extends Mage_Adminhtml_Block_Widget_Grid_Container
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
// The blockGroup must match the first half of how we call the block, and controller matches the second half
|
7 |
+
// ie. foo_bar/adminhtml_baz
|
8 |
+
$this->_blockGroup = 'freightcenter_customware';
|
9 |
+
$this->_controller = 'adminhtml_collect';
|
10 |
+
$this->_headerText = $this->__('All Warehouses');
|
11 |
+
|
12 |
+
parent::__construct();
|
13 |
+
}
|
14 |
+
}
|
app/code/local/Freightcenter/CustomWare/Block/Adminhtml/Collect/Edit.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Freightcenter_CustomWare_Block_Adminhtml_Collect_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Init class
|
6 |
+
*/
|
7 |
+
public function __construct()
|
8 |
+
{
|
9 |
+
$this->_blockGroup = 'freightcenter_customware';
|
10 |
+
$this->_controller = 'adminhtml_collect';
|
11 |
+
|
12 |
+
parent::__construct();
|
13 |
+
|
14 |
+
$this->_updateButton('save', 'label', $this->__('Save Warehouse'));
|
15 |
+
$this->_updateButton('delete', 'label', $this->__('Delete Warehouse'));
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Get Header text
|
20 |
+
*
|
21 |
+
* @return string
|
22 |
+
*/
|
23 |
+
public function getHeaderText()
|
24 |
+
{
|
25 |
+
if (Mage::registry('freightcenter_customware')->getId()) {
|
26 |
+
return $this->__('Edit Warehouse');
|
27 |
+
}
|
28 |
+
else {
|
29 |
+
return $this->__('New Warehouse');
|
30 |
+
}
|
31 |
+
}
|
32 |
+
}
|
app/code/local/Freightcenter/CustomWare/Block/Adminhtml/Collect/Edit/Form.php
ADDED
@@ -0,0 +1,478 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Freightcenter_CustomWare_Block_Adminhtml_Collect_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Init class
|
6 |
+
*/
|
7 |
+
public function __construct()
|
8 |
+
{
|
9 |
+
parent::__construct();
|
10 |
+
|
11 |
+
$this->setId('freightcenter_customware_collect_form');
|
12 |
+
$this->setTitle($this->__('Collect Information'));
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Setup form fields for inserts/updates
|
17 |
+
*
|
18 |
+
* return Mage_Adminhtml_Block_Widget_Form
|
19 |
+
*/
|
20 |
+
protected function _prepareForm()
|
21 |
+
{
|
22 |
+
$model = Mage::registry('freightcenter_customware');
|
23 |
+
|
24 |
+
$form = new Varien_Data_Form(array(
|
25 |
+
'id' => 'edit_form',
|
26 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
27 |
+
'method' => 'post'
|
28 |
+
));
|
29 |
+
|
30 |
+
$fieldset = $form->addFieldset('base_fieldset', array(
|
31 |
+
'legend' => Mage::helper('checkout')->__('Collect Information'),
|
32 |
+
'class' => 'fieldset-wide',
|
33 |
+
));
|
34 |
+
|
35 |
+
if ($model->getId()) {
|
36 |
+
$fieldset->addField('id', 'hidden', array(
|
37 |
+
'name' => 'id',
|
38 |
+
));
|
39 |
+
}
|
40 |
+
|
41 |
+
$fieldset->addField('short_name', 'text', array(
|
42 |
+
'name' => 'short_name',
|
43 |
+
'label' => Mage::helper('checkout')->__('Short Name'),
|
44 |
+
'title' => Mage::helper('checkout')->__('Short Name'),
|
45 |
+
'required' => true,
|
46 |
+
));
|
47 |
+
|
48 |
+
$fieldset->addField('cmpny_name', 'text', array(
|
49 |
+
'name' => 'cmpny_name',
|
50 |
+
'label' => Mage::helper('checkout')->__('Company Name'),
|
51 |
+
'title' => Mage::helper('checkout')->__('Company Name'),
|
52 |
+
'required' => true,
|
53 |
+
));
|
54 |
+
$fieldset->addField('cmpny_postcode', 'text', array(
|
55 |
+
'name' => 'cmpny_postcode',
|
56 |
+
'label' => Mage::helper('checkout')->__('Company PostCode'),
|
57 |
+
'title' => Mage::helper('checkout')->__('Company PostCode'),
|
58 |
+
'required' => true,
|
59 |
+
));
|
60 |
+
|
61 |
+
$fieldset->addField('address', 'text', array(
|
62 |
+
'name' => 'address',
|
63 |
+
'label' => Mage::helper('checkout')->__('Full Address'),
|
64 |
+
'title' => Mage::helper('checkout')->__('Full Address'),
|
65 |
+
'required' => true,
|
66 |
+
));
|
67 |
+
$fieldset->addField('street', 'text', array(
|
68 |
+
'name' => 'street',
|
69 |
+
'label' => Mage::helper('checkout')->__('Full Street'),
|
70 |
+
'title' => Mage::helper('checkout')->__('Full Street'),
|
71 |
+
'required' => true,
|
72 |
+
));
|
73 |
+
$fieldset->addField('city', 'text', array(
|
74 |
+
'name' => 'city',
|
75 |
+
'label' => Mage::helper('checkout')->__('Full City'),
|
76 |
+
'title' => Mage::helper('checkout')->__('Full City'),
|
77 |
+
'required' => true,
|
78 |
+
));
|
79 |
+
$fieldset->addField('state', 'text', array(
|
80 |
+
'name' => 'state',
|
81 |
+
'label' => Mage::helper('checkout')->__('Full State'),
|
82 |
+
'title' => Mage::helper('checkout')->__('Full State'),
|
83 |
+
'required' => true,
|
84 |
+
));
|
85 |
+
$fieldset->addField('country_id', 'text', array(
|
86 |
+
'name' => 'country_id',
|
87 |
+
'label' => Mage::helper('checkout')->__('Full Country'),
|
88 |
+
'title' => Mage::helper('checkout')->__('Full Country'),
|
89 |
+
'required' => true,
|
90 |
+
));
|
91 |
+
|
92 |
+
|
93 |
+
$fieldset->addField('first_name', 'text', array(
|
94 |
+
'name' => 'first_name',
|
95 |
+
'label' => Mage::helper('checkout')->__('First Name'),
|
96 |
+
'title' => Mage::helper('checkout')->__('First Name'),
|
97 |
+
'required' => true,
|
98 |
+
));
|
99 |
+
|
100 |
+
$fieldset->addField('last_name', 'text', array(
|
101 |
+
'name' => 'last_name',
|
102 |
+
'label' => Mage::helper('checkout')->__('Last Name'),
|
103 |
+
'title' => Mage::helper('checkout')->__('Last Name'),
|
104 |
+
'required' => true,
|
105 |
+
));
|
106 |
+
|
107 |
+
$fieldset->addField('phone', 'text', array(
|
108 |
+
'name' => 'phone',
|
109 |
+
'label' => Mage::helper('checkout')->__('Phone'),
|
110 |
+
'title' => Mage::helper('checkout')->__('Phone'),
|
111 |
+
'required' => true,
|
112 |
+
));
|
113 |
+
|
114 |
+
$fieldset->addField('email', 'text', array(
|
115 |
+
'name' => 'email',
|
116 |
+
'label' => Mage::helper('checkout')->__('Email'),
|
117 |
+
'title' => Mage::helper('checkout')->__('Email'),
|
118 |
+
'required' => true,
|
119 |
+
));
|
120 |
+
|
121 |
+
// $fieldset->addField('accessorials', 'checkboxes', array(
|
122 |
+
// 'label' => $this->__('Accessorials'),
|
123 |
+
// 'name' => 'accessorials[]',
|
124 |
+
// 'values' => array(
|
125 |
+
// array('value'=>'1','label'=>'Include A Lift Gate At Pickup'),
|
126 |
+
// array('value'=>'2','label'=>'Is Limited Access Pickup Area'),
|
127 |
+
// array('value'=>'3','label'=>'Is Inside Pickup'),
|
128 |
+
// array('value'=>'4','label'=>'Call For Pickup Appointment'),
|
129 |
+
// ),
|
130 |
+
// 'required' => true,
|
131 |
+
// ));
|
132 |
+
|
133 |
+
/* $fieldset->addField('accessorials', 'multiselect', array(
|
134 |
+
'label' => $this->__('Accessorials'),
|
135 |
+
'name' => 'accessorials[]',
|
136 |
+
'values' => array(
|
137 |
+
array('value'=>'1','label'=>'Include A Lift Gate At Pickup'),
|
138 |
+
array('value'=>'2','label'=>'Is Limited Access Pickup Area'),
|
139 |
+
array('value'=>'3','label'=>'Is Inside Pickup'),
|
140 |
+
array('value'=>'4','label'=>'Call For Pickup Appointment'),
|
141 |
+
),
|
142 |
+
'required' => true,
|
143 |
+
)); */
|
144 |
+
|
145 |
+
|
146 |
+
|
147 |
+
|
148 |
+
/* $fieldset->addField('accessorials', 'checkboxes', array(
|
149 |
+
'label' => $this->__('Accessorials'),
|
150 |
+
'name' => 'accessorials[]',
|
151 |
+
'values' => array(
|
152 |
+
array('value'=>'1','label'=>'Include A Lift Gate At Pickup'),
|
153 |
+
array('value'=>'2','label'=>'Is Limited Access Pickup Area'),
|
154 |
+
array('value'=>'3','label'=>'Is Inside Pickup'),
|
155 |
+
array('value'=>'4','label'=>'Call For Pickup Appointment'),
|
156 |
+
),
|
157 |
+
|
158 |
+
'value' => array('1','2','3','4'),
|
159 |
+
'Enabled' => true,
|
160 |
+
'required' => true,
|
161 |
+
|
162 |
+
));
|
163 |
+
*/
|
164 |
+
|
165 |
+
|
166 |
+
|
167 |
+
|
168 |
+
|
169 |
+
$fieldset->addField('location_type', 'select', array(
|
170 |
+
'label' => $this->__('Origin Location Type'),
|
171 |
+
'class' => 'required-entry',
|
172 |
+
'required' => true,
|
173 |
+
'onclick' => "AccessSelect(this.value)",
|
174 |
+
'name' => 'location_type',
|
175 |
+
'values' => array(''=>'Please Select','Residential' => 'Residential / Curb-side','Business With Dock or Forklift' => 'Business With Dock or Forklift'
|
176 |
+
,'Business Without Dock or Forklift' => 'Business Without Dock or Forklift','Construction Site' => 'Construction Site',
|
177 |
+
'Convention Center or Tradeshow' => 'Convention Center or Tradeshow','Terminal'=>'Terminal'),
|
178 |
+
));
|
179 |
+
|
180 |
+
|
181 |
+
$fieldset->addField('accessorials', 'checkboxes', array(
|
182 |
+
'label' => $this->__('Accessorials'),
|
183 |
+
'name' => 'accessorials[]',
|
184 |
+
'values' => array(
|
185 |
+
array('value'=>'1','label'=>'Include A Lift Gate At Pickup'),
|
186 |
+
array('value'=>'2','label'=>'Is Limited Access Pickup Area'),
|
187 |
+
array('value'=>'3','label'=>'Is Inside Pickup'),
|
188 |
+
array('value'=>'4','label'=>'Call For Pickup Appointment'),
|
189 |
+
),
|
190 |
+
'required' => true,
|
191 |
+
));
|
192 |
+
|
193 |
+
$fieldset->addField('hours', 'text', array(
|
194 |
+
'name' => 'hours',
|
195 |
+
'label' => Mage::helper('checkout')->__('Hours of Operation'),
|
196 |
+
'title' => Mage::helper('checkout')->__('Hours of Operation'),
|
197 |
+
'style' => "275px !important",
|
198 |
+
'required' => true,
|
199 |
+
));
|
200 |
+
|
201 |
+
$form->setValues($model->getData());
|
202 |
+
$form->setUseContainer(true);
|
203 |
+
$this->setForm($form);
|
204 |
+
|
205 |
+
return parent::_prepareForm();
|
206 |
+
}
|
207 |
+
}
|
208 |
+
$params = Mage::app()->getRequest()->getParam('id');
|
209 |
+
if($params != NULL) {
|
210 |
+
$warehouses = Mage::getModel('freightcenter_customware/collect')->load($params);
|
211 |
+
$getaccessorials = $warehouses['accessorials'];
|
212 |
+
$location_type = $warehouses['location_type'];
|
213 |
+
//echo "<pre>";print_r($location_type);exit;
|
214 |
+
$baseurl = Mage::getBaseUrl();
|
215 |
+
if(strstr($baseurl,'index.php')) {
|
216 |
+
$baseurl = str_replace('/index.php','',$baseurl);
|
217 |
+
}
|
218 |
+
?>
|
219 |
+
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
|
220 |
+
<script type=text/javascript>
|
221 |
+
jQuery(document).ready(function() {
|
222 |
+
AccessSelect_one('<?php echo $location_type; ?>');
|
223 |
+
var access = '<?php echo $getaccessorials; ?>';
|
224 |
+
var myacess = access.split(",");
|
225 |
+
var i;
|
226 |
+
for(i = 0; i < myacess.length; i++) {
|
227 |
+
jQuery('#accessorials_'+myacess[i]).attr('checked','checked');
|
228 |
+
}
|
229 |
+
|
230 |
+
});
|
231 |
+
function AccessSelect(id){
|
232 |
+
if(id == ''){
|
233 |
+
|
234 |
+
jQuery(".checkboxes li:nth-of-type(2)").css('display', 'none') ;
|
235 |
+
jQuery(".checkboxes li:nth-of-type(3)").css('display', 'none') ;
|
236 |
+
jQuery(".checkboxes li:nth-of-type(4)").css('display', 'none') ;
|
237 |
+
jQuery(".checkboxes li:nth-of-type(1)").css('display', 'none') ;
|
238 |
+
jQuery(".checkboxes input[type=checkbox]").attr('checked', false);
|
239 |
+
|
240 |
+
}
|
241 |
+
if(id == 'Residential'){
|
242 |
+
|
243 |
+
jQuery(".checkboxes li:nth-of-type(2)").css('display', 'none') ;
|
244 |
+
jQuery(".checkboxes li:nth-of-type(3)").css('display', 'none') ;
|
245 |
+
jQuery(".checkboxes li:nth-of-type(4)").css('display', 'none') ;
|
246 |
+
jQuery(".checkboxes li:nth-of-type(1)").css('display', 'block') ;
|
247 |
+
jQuery(".checkboxes input[type=checkbox]").attr('checked', false);
|
248 |
+
}
|
249 |
+
if(id == 'Business With Dock or Forklift'){
|
250 |
+
|
251 |
+
jQuery(".checkboxes li:nth-of-type(1)").css('display', 'none') ;
|
252 |
+
jQuery(".checkboxes li:nth-of-type(4)").css('display', 'none') ;
|
253 |
+
jQuery(".checkboxes li:nth-of-type(2)").css('display', 'block') ;
|
254 |
+
jQuery(".checkboxes li:nth-of-type(3)").css('display', 'block') ;
|
255 |
+
jQuery(".checkboxes input[type=checkbox]").attr('checked', false);
|
256 |
+
}
|
257 |
+
if(id == 'Business Without Dock or Forklift'){
|
258 |
+
|
259 |
+
jQuery(".checkboxes li:nth-of-type(3)").css('display', 'none') ;
|
260 |
+
jQuery(".checkboxes li:nth-of-type(4)").css('display', 'none') ;
|
261 |
+
jQuery(".checkboxes li:nth-of-type(1)").css('display', 'block') ;
|
262 |
+
jQuery(".checkboxes li:nth-of-type(2)").css('display', 'block') ;
|
263 |
+
jQuery(".checkboxes input[type=checkbox]").attr('checked', false);
|
264 |
+
}
|
265 |
+
if(id == 'Construction Site'){
|
266 |
+
|
267 |
+
jQuery(".checkboxes li:nth-of-type(1)").css('display', 'block') ;
|
268 |
+
jQuery(".checkboxes li:nth-of-type(2)").css('display', 'none') ;
|
269 |
+
jQuery(".checkboxes li:nth-of-type(3)").css('display', 'none') ;
|
270 |
+
jQuery(".checkboxes li:nth-of-type(4)").css('display', 'none') ;
|
271 |
+
jQuery(".checkboxes input[type=checkbox]").attr('checked', false);
|
272 |
+
}
|
273 |
+
if(id == 'Convention Center or Tradeshow'){
|
274 |
+
|
275 |
+
jQuery(".checkboxes li:nth-of-type(1)").css('display', 'block') ;
|
276 |
+
jQuery(".checkboxes li:nth-of-type(2)").css('display', 'none') ;
|
277 |
+
jQuery(".checkboxes li:nth-of-type(3)").css('display', 'none') ;
|
278 |
+
jQuery(".checkboxes li:nth-of-type(4)").css('display', 'none') ;
|
279 |
+
jQuery(".checkboxes input[type=checkbox]").attr('checked', false);
|
280 |
+
}
|
281 |
+
if(id == 'Terminal'){
|
282 |
+
|
283 |
+
jQuery(".checkboxes li:nth-of-type(1)").css('display', 'none') ;
|
284 |
+
jQuery(".checkboxes li:nth-of-type(2)").css('display', 'none') ;
|
285 |
+
jQuery(".checkboxes li:nth-of-type(3)").css('display', 'none') ;
|
286 |
+
jQuery(".checkboxes li:nth-of-type(4)").css('display', 'none') ;
|
287 |
+
jQuery(".checkboxes input[type=checkbox]").attr('checked', false);
|
288 |
+
}
|
289 |
+
}
|
290 |
+
function AccessSelect_one(id){
|
291 |
+
if(id == ''){
|
292 |
+
|
293 |
+
jQuery(".checkboxes li:nth-of-type(2)").css('display', 'none') ;
|
294 |
+
jQuery(".checkboxes li:nth-of-type(3)").css('display', 'none') ;
|
295 |
+
jQuery(".checkboxes li:nth-of-type(4)").css('display', 'none') ;
|
296 |
+
jQuery(".checkboxes li:nth-of-type(1)").css('display', 'none') ;
|
297 |
+
|
298 |
+
}
|
299 |
+
if(id == 'Residential'){
|
300 |
+
|
301 |
+
jQuery(".checkboxes li:nth-of-type(2)").css('display', 'none') ;
|
302 |
+
jQuery(".checkboxes li:nth-of-type(3)").css('display', 'none') ;
|
303 |
+
jQuery(".checkboxes li:nth-of-type(4)").css('display', 'none') ;
|
304 |
+
jQuery(".checkboxes li:nth-of-type(1)").css('display', 'block') ;
|
305 |
+
|
306 |
+
}
|
307 |
+
if(id == 'Business With Dock or Forklift'){
|
308 |
+
|
309 |
+
jQuery(".checkboxes li:nth-of-type(1)").css('display', 'none') ;
|
310 |
+
jQuery(".checkboxes li:nth-of-type(4)").css('display', 'none') ;
|
311 |
+
jQuery(".checkboxes li:nth-of-type(2)").css('display', 'block') ;
|
312 |
+
jQuery(".checkboxes li:nth-of-type(3)").css('display', 'block') ;
|
313 |
+
|
314 |
+
}
|
315 |
+
if(id == 'Business Without Dock or Forklift'){
|
316 |
+
|
317 |
+
jQuery(".checkboxes li:nth-of-type(3)").css('display', 'none') ;
|
318 |
+
jQuery(".checkboxes li:nth-of-type(4)").css('display', 'none') ;
|
319 |
+
jQuery(".checkboxes li:nth-of-type(1)").css('display', 'block') ;
|
320 |
+
jQuery(".checkboxes li:nth-of-type(2)").css('display', 'block') ;
|
321 |
+
|
322 |
+
}
|
323 |
+
if(id == 'Construction Site'){
|
324 |
+
|
325 |
+
jQuery(".checkboxes li:nth-of-type(1)").css('display', 'block') ;
|
326 |
+
jQuery(".checkboxes li:nth-of-type(2)").css('display', 'none') ;
|
327 |
+
jQuery(".checkboxes li:nth-of-type(3)").css('display', 'none') ;
|
328 |
+
jQuery(".checkboxes li:nth-of-type(4)").css('display', 'none') ;
|
329 |
+
|
330 |
+
}
|
331 |
+
if(id == 'Convention Center or Tradeshow'){
|
332 |
+
|
333 |
+
jQuery(".checkboxes li:nth-of-type(1)").css('display', 'block') ;
|
334 |
+
jQuery(".checkboxes li:nth-of-type(2)").css('display', 'none') ;
|
335 |
+
jQuery(".checkboxes li:nth-of-type(3)").css('display', 'none') ;
|
336 |
+
jQuery(".checkboxes li:nth-of-type(4)").css('display', 'none') ;
|
337 |
+
|
338 |
+
}
|
339 |
+
if(id == 'Terminal'){
|
340 |
+
|
341 |
+
jQuery(".checkboxes li:nth-of-type(1)").css('display', 'none') ;
|
342 |
+
jQuery(".checkboxes li:nth-of-type(2)").css('display', 'none') ;
|
343 |
+
jQuery(".checkboxes li:nth-of-type(3)").css('display', 'none') ;
|
344 |
+
jQuery(".checkboxes li:nth-of-type(4)").css('display', 'none') ;
|
345 |
+
|
346 |
+
}
|
347 |
+
}
|
348 |
+
|
349 |
+
</script>
|
350 |
+
<?php } else { ?>
|
351 |
+
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
|
352 |
+
<script type=text/javascript>
|
353 |
+
jQuery(document).ready(function() {
|
354 |
+
var id = '';
|
355 |
+
AccessSelect_one(id);
|
356 |
+
|
357 |
+
});
|
358 |
+
function AccessSelect(id){
|
359 |
+
if(id == ''){
|
360 |
+
|
361 |
+
jQuery(".checkboxes li:nth-of-type(2)").css('display', 'none') ;
|
362 |
+
jQuery(".checkboxes li:nth-of-type(3)").css('display', 'none') ;
|
363 |
+
jQuery(".checkboxes li:nth-of-type(4)").css('display', 'none') ;
|
364 |
+
jQuery(".checkboxes li:nth-of-type(1)").css('display', 'none') ;
|
365 |
+
jQuery(".checkboxes input[type=checkbox]").attr('checked', false);
|
366 |
+
|
367 |
+
}
|
368 |
+
if(id == 'Residential'){
|
369 |
+
|
370 |
+
jQuery(".checkboxes li:nth-of-type(2)").css('display', 'none') ;
|
371 |
+
jQuery(".checkboxes li:nth-of-type(3)").css('display', 'none') ;
|
372 |
+
jQuery(".checkboxes li:nth-of-type(4)").css('display', 'none') ;
|
373 |
+
jQuery(".checkboxes li:nth-of-type(1)").css('display', 'block') ;
|
374 |
+
jQuery(".checkboxes input[type=checkbox]").attr('checked', false);
|
375 |
+
}
|
376 |
+
if(id == 'Business With Dock or Forklift'){
|
377 |
+
|
378 |
+
jQuery(".checkboxes li:nth-of-type(1)").css('display', 'none') ;
|
379 |
+
jQuery(".checkboxes li:nth-of-type(4)").css('display', 'none') ;
|
380 |
+
jQuery(".checkboxes li:nth-of-type(2)").css('display', 'block') ;
|
381 |
+
jQuery(".checkboxes li:nth-of-type(3)").css('display', 'block') ;
|
382 |
+
jQuery(".checkboxes input[type=checkbox]").attr('checked', false);
|
383 |
+
}
|
384 |
+
if(id == 'Business Without Dock or Forklift'){
|
385 |
+
|
386 |
+
jQuery(".checkboxes li:nth-of-type(3)").css('display', 'none') ;
|
387 |
+
jQuery(".checkboxes li:nth-of-type(4)").css('display', 'none') ;
|
388 |
+
jQuery(".checkboxes li:nth-of-type(1)").css('display', 'block') ;
|
389 |
+
jQuery(".checkboxes li:nth-of-type(2)").css('display', 'block') ;
|
390 |
+
jQuery(".checkboxes input[type=checkbox]").attr('checked', false);
|
391 |
+
}
|
392 |
+
if(id == 'Construction Site'){
|
393 |
+
|
394 |
+
jQuery(".checkboxes li:nth-of-type(1)").css('display', 'block') ;
|
395 |
+
jQuery(".checkboxes li:nth-of-type(2)").css('display', 'none') ;
|
396 |
+
jQuery(".checkboxes li:nth-of-type(3)").css('display', 'none') ;
|
397 |
+
jQuery(".checkboxes li:nth-of-type(4)").css('display', 'none') ;
|
398 |
+
jQuery(".checkboxes input[type=checkbox]").attr('checked', false);
|
399 |
+
}
|
400 |
+
if(id == 'Convention Center or Tradeshow'){
|
401 |
+
|
402 |
+
jQuery(".checkboxes li:nth-of-type(1)").css('display', 'block') ;
|
403 |
+
jQuery(".checkboxes li:nth-of-type(2)").css('display', 'none') ;
|
404 |
+
jQuery(".checkboxes li:nth-of-type(3)").css('display', 'none') ;
|
405 |
+
jQuery(".checkboxes li:nth-of-type(4)").css('display', 'none') ;
|
406 |
+
jQuery(".checkboxes input[type=checkbox]").attr('checked', false);
|
407 |
+
}
|
408 |
+
if(id == 'Terminal'){
|
409 |
+
|
410 |
+
jQuery(".checkboxes li:nth-of-type(1)").css('display', 'none') ;
|
411 |
+
jQuery(".checkboxes li:nth-of-type(2)").css('display', 'none') ;
|
412 |
+
jQuery(".checkboxes li:nth-of-type(3)").css('display', 'none') ;
|
413 |
+
jQuery(".checkboxes li:nth-of-type(4)").css('display', 'none') ;
|
414 |
+
jQuery(".checkboxes input[type=checkbox]").attr('checked', false);
|
415 |
+
}
|
416 |
+
}
|
417 |
+
function AccessSelect_one(id){
|
418 |
+
if(id == ''){
|
419 |
+
|
420 |
+
jQuery(".checkboxes li:nth-of-type(2)").css('display', 'none') ;
|
421 |
+
jQuery(".checkboxes li:nth-of-type(3)").css('display', 'none') ;
|
422 |
+
jQuery(".checkboxes li:nth-of-type(4)").css('display', 'none') ;
|
423 |
+
jQuery(".checkboxes li:nth-of-type(1)").css('display', 'none') ;
|
424 |
+
|
425 |
+
|
426 |
+
}
|
427 |
+
if(id == 'Residential'){
|
428 |
+
|
429 |
+
jQuery(".checkboxes li:nth-of-type(2)").css('display', 'none') ;
|
430 |
+
jQuery(".checkboxes li:nth-of-type(3)").css('display', 'none') ;
|
431 |
+
jQuery(".checkboxes li:nth-of-type(4)").css('display', 'none') ;
|
432 |
+
jQuery(".checkboxes li:nth-of-type(1)").css('display', 'block') ;
|
433 |
+
|
434 |
+
}
|
435 |
+
if(id == 'Business With Dock or Forklift'){
|
436 |
+
|
437 |
+
jQuery(".checkboxes li:nth-of-type(1)").css('display', 'none') ;
|
438 |
+
jQuery(".checkboxes li:nth-of-type(4)").css('display', 'none') ;
|
439 |
+
jQuery(".checkboxes li:nth-of-type(2)").css('display', 'block') ;
|
440 |
+
jQuery(".checkboxes li:nth-of-type(3)").css('display', 'block') ;
|
441 |
+
|
442 |
+
}
|
443 |
+
if(id == 'Business Without Dock or Forklift'){
|
444 |
+
|
445 |
+
jQuery(".checkboxes li:nth-of-type(3)").css('display', 'none') ;
|
446 |
+
jQuery(".checkboxes li:nth-of-type(4)").css('display', 'none') ;
|
447 |
+
jQuery(".checkboxes li:nth-of-type(1)").css('display', 'block') ;
|
448 |
+
jQuery(".checkboxes li:nth-of-type(2)").css('display', 'block') ;
|
449 |
+
|
450 |
+
}
|
451 |
+
if(id == 'Construction Site'){
|
452 |
+
|
453 |
+
jQuery(".checkboxes li:nth-of-type(1)").css('display', 'block') ;
|
454 |
+
jQuery(".checkboxes li:nth-of-type(2)").css('display', 'none') ;
|
455 |
+
jQuery(".checkboxes li:nth-of-type(3)").css('display', 'none') ;
|
456 |
+
jQuery(".checkboxes li:nth-of-type(4)").css('display', 'none') ;
|
457 |
+
|
458 |
+
}
|
459 |
+
if(id == 'Convention Center or Tradeshow'){
|
460 |
+
|
461 |
+
jQuery(".checkboxes li:nth-of-type(1)").css('display', 'block') ;
|
462 |
+
jQuery(".checkboxes li:nth-of-type(2)").css('display', 'none') ;
|
463 |
+
jQuery(".checkboxes li:nth-of-type(3)").css('display', 'none') ;
|
464 |
+
jQuery(".checkboxes li:nth-of-type(4)").css('display', 'none') ;
|
465 |
+
|
466 |
+
}
|
467 |
+
if(id == 'Terminal'){
|
468 |
+
|
469 |
+
jQuery(".checkboxes li:nth-of-type(1)").css('display', 'none') ;
|
470 |
+
jQuery(".checkboxes li:nth-of-type(2)").css('display', 'none') ;
|
471 |
+
jQuery(".checkboxes li:nth-of-type(3)").css('display', 'none') ;
|
472 |
+
jQuery(".checkboxes li:nth-of-type(4)").css('display', 'none') ;
|
473 |
+
|
474 |
+
}
|
475 |
+
}
|
476 |
+
</script>
|
477 |
+
|
478 |
+
<?php } ?>
|
app/code/local/Freightcenter/CustomWare/Block/Adminhtml/Collect/Grid.php
ADDED
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Freightcenter_CustomWare_Block_Adminhtml_Collect_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
parent::__construct();
|
7 |
+
|
8 |
+
// Set some defaults for our grid
|
9 |
+
$this->setDefaultSort('id');
|
10 |
+
$this->setId('freightcenter_customware_collect_grid');
|
11 |
+
$this->setDefaultDir('asc');
|
12 |
+
$this->setSaveParametersInSession(true);
|
13 |
+
}
|
14 |
+
|
15 |
+
protected function _getCollectionClass()
|
16 |
+
{
|
17 |
+
// This is the model we are using for the grid
|
18 |
+
return 'freightcenter_customware/collect_collection';
|
19 |
+
}
|
20 |
+
|
21 |
+
protected function _prepareCollection()
|
22 |
+
{
|
23 |
+
// Get and set our collection for the grid
|
24 |
+
$collection = Mage::getResourceModel($this->_getCollectionClass());
|
25 |
+
$this->setCollection($collection);
|
26 |
+
|
27 |
+
return parent::_prepareCollection();
|
28 |
+
}
|
29 |
+
|
30 |
+
protected function _prepareColumns()
|
31 |
+
{
|
32 |
+
// Add the columns that should appear in the grid
|
33 |
+
$this->addColumn('id',
|
34 |
+
array(
|
35 |
+
'header'=> $this->__('ID'),
|
36 |
+
'align' =>'right',
|
37 |
+
'width' => '50px',
|
38 |
+
'index' => 'id'
|
39 |
+
)
|
40 |
+
);
|
41 |
+
|
42 |
+
$this->addColumn('short_name',
|
43 |
+
array(
|
44 |
+
'header'=> $this->__('Short Name'),
|
45 |
+
'index' => 'short_name'
|
46 |
+
)
|
47 |
+
);
|
48 |
+
|
49 |
+
$this->addColumn('cmpny_name',
|
50 |
+
array(
|
51 |
+
'header'=> $this->__('Company Name'),
|
52 |
+
'index' => 'cmpny_name'
|
53 |
+
)
|
54 |
+
);
|
55 |
+
$this->addColumn('cmpny_postcode',
|
56 |
+
array(
|
57 |
+
'header'=> $this->__('Company PostCode'),
|
58 |
+
'index' => 'cmpny_postcode'
|
59 |
+
)
|
60 |
+
);
|
61 |
+
|
62 |
+
$this->addColumn('address',
|
63 |
+
array(
|
64 |
+
'header'=> $this->__('Address'),
|
65 |
+
'index' => 'address'
|
66 |
+
)
|
67 |
+
);
|
68 |
+
|
69 |
+
$this->addColumn('first_name',
|
70 |
+
array(
|
71 |
+
'header'=> $this->__('First Name'),
|
72 |
+
'index' => 'first_name'
|
73 |
+
)
|
74 |
+
);
|
75 |
+
|
76 |
+
$this->addColumn('last_name',
|
77 |
+
array(
|
78 |
+
'header'=> $this->__('Last Name'),
|
79 |
+
'index' => 'last_name'
|
80 |
+
)
|
81 |
+
);
|
82 |
+
|
83 |
+
$this->addColumn('phone',
|
84 |
+
array(
|
85 |
+
'header'=> $this->__('Phone'),
|
86 |
+
'index' => 'phone'
|
87 |
+
)
|
88 |
+
);
|
89 |
+
|
90 |
+
$this->addColumn('email',
|
91 |
+
array(
|
92 |
+
'header'=> $this->__('Email'),
|
93 |
+
'index' => 'email'
|
94 |
+
)
|
95 |
+
);
|
96 |
+
|
97 |
+
$this->addColumn('location_type',
|
98 |
+
array(
|
99 |
+
'header'=> $this->__('Location Type'),
|
100 |
+
'index' => 'location_type'
|
101 |
+
)
|
102 |
+
);
|
103 |
+
|
104 |
+
return parent::_prepareColumns();
|
105 |
+
}
|
106 |
+
|
107 |
+
public function getRowUrl($row)
|
108 |
+
{
|
109 |
+
// This is where our row data will link to
|
110 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
111 |
+
}
|
112 |
+
}
|
app/code/local/Freightcenter/CustomWare/Helper/Data.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Freightcenter_CustomWare_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
}
|
app/code/local/Freightcenter/CustomWare/Model/Collect.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Freightcenter_CustomWare_Model_Collect extends Mage_Core_Model_Abstract
|
3 |
+
{
|
4 |
+
protected function _construct()
|
5 |
+
{
|
6 |
+
$this->_init('freightcenter_customware/collect');
|
7 |
+
}
|
8 |
+
}
|
app/code/local/Freightcenter/CustomWare/Model/Mysql4/Collect.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Freightcenter_CustomWare_Model_Mysql4_Collect extends Mage_Core_Model_Mysql4_Abstract
|
3 |
+
{
|
4 |
+
protected function _construct()
|
5 |
+
{
|
6 |
+
$this->_init('freightcenter_customware/collect', 'id');
|
7 |
+
}
|
8 |
+
}
|
app/code/local/Freightcenter/CustomWare/Model/Mysql4/Collect/Collection.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Freightcenter_CustomWare_Model_Mysql4_Collect_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
3 |
+
{
|
4 |
+
protected function _construct()
|
5 |
+
{
|
6 |
+
$this->_init('freightcenter_customware/collect');
|
7 |
+
}
|
8 |
+
}
|
app/code/local/Freightcenter/CustomWare/controllers/Adminhtml/CollectController.php
ADDED
@@ -0,0 +1,247 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Freightcenter_CustomWare_Adminhtml_CollectController extends Mage_Adminhtml_Controller_Action
|
3 |
+
{
|
4 |
+
public function _construct()
|
5 |
+
{
|
6 |
+
$check2 = Mage::getModel('catalog/resource_eav_attribute')->loadByCode('catalog_product','freight_class');
|
7 |
+
if($check2->getId() != NULL) {
|
8 |
+
/* add options to attribute */
|
9 |
+
$freightclasses = array('50','55','60','65','70','77.5','82','92.5','100','110','125','150','175','200','250','300','400','500');
|
10 |
+
/* add options to dropdown attribute */
|
11 |
+
$manufacturer = Mage::getModel('eav/config')->getAttribute('catalog_product','freight_class');
|
12 |
+
foreach ( $manufacturer->getSource()->getAllOptions(true, true) as $option_manu){
|
13 |
+
$manufacturer_attribute[$option_manu['label']] = $option_manu['value'];
|
14 |
+
}
|
15 |
+
|
16 |
+
foreach($freightclasses as $class) {
|
17 |
+
$manufacture = $class;
|
18 |
+
|
19 |
+
/* add option values in manufacturer attribute */
|
20 |
+
$getOption = $manufacturer_attribute[$manufacture];
|
21 |
+
if(!$getOption) {
|
22 |
+
$arg_attribute = 'freight_class';
|
23 |
+
$attribute_model = Mage::getModel('eav/entity_attribute');
|
24 |
+
|
25 |
+
$attribute_code = $attribute_model->getIdByCode('catalog_product', $arg_attribute);
|
26 |
+
$attribute = $attribute_model->load($attribute_code);
|
27 |
+
|
28 |
+
$val['option'] = array($manufacture,$manufacture);
|
29 |
+
$result = array('value' => $val);
|
30 |
+
$attribute->setData('option',$result);
|
31 |
+
$attribute->save();
|
32 |
+
}
|
33 |
+
}
|
34 |
+
}
|
35 |
+
|
36 |
+
$check9 = Mage::getModel('catalog/resource_eav_attribute')->loadByCode('catalog_product','packaging_type');
|
37 |
+
if($check9->getId() != NULL) {
|
38 |
+
$packagin_types = array('Boxed','Crated','Drums or Barrels','Palletized','Un-packaged');
|
39 |
+
/* add options to dropdown attribute */
|
40 |
+
$package_type = Mage::getModel('eav/config')->getAttribute('catalog_product','packaging_type');
|
41 |
+
foreach ( $package_type->getSource()->getAllOptions(true, true) as $option_menu){
|
42 |
+
$packaging_attribute[$option_menu['label']] = $option_menu['value'];
|
43 |
+
}
|
44 |
+
|
45 |
+
foreach($packagin_types as $types) {
|
46 |
+
$pkg_type = $types;
|
47 |
+
|
48 |
+
/* add option values in manufacturer attribute */
|
49 |
+
$getoption = $packaging_attribute[$pkg_type];
|
50 |
+
if(!$getoption) {
|
51 |
+
$arg_attribute = 'packaging_type';
|
52 |
+
$attribute_model = Mage::getModel('eav/entity_attribute');
|
53 |
+
|
54 |
+
$attribute_code = $attribute_model->getIdByCode('catalog_product', $arg_attribute);
|
55 |
+
$attribute = $attribute_model->load($attribute_code);
|
56 |
+
|
57 |
+
$val['option'] = array($pkg_type,$pkg_type);
|
58 |
+
$result = array('value' => $val);
|
59 |
+
$attribute->setData('option',$result);
|
60 |
+
$attribute->save();
|
61 |
+
}
|
62 |
+
}
|
63 |
+
}
|
64 |
+
/* end adding options */
|
65 |
+
}
|
66 |
+
|
67 |
+
public function indexAction()
|
68 |
+
{
|
69 |
+
// Let's call our initAction method which will set some basic params for each action
|
70 |
+
$this->_initAction()
|
71 |
+
->renderLayout();
|
72 |
+
}
|
73 |
+
|
74 |
+
public function newAction()
|
75 |
+
{
|
76 |
+
// We just forward the new action to a blank edit form
|
77 |
+
$this->_forward('edit');
|
78 |
+
}
|
79 |
+
|
80 |
+
public function editAction()
|
81 |
+
{
|
82 |
+
$this->_initAction();
|
83 |
+
|
84 |
+
// Get id if available
|
85 |
+
$id = $this->getRequest()->getParam('id');
|
86 |
+
$model = Mage::getModel('freightcenter_customware/collect');
|
87 |
+
|
88 |
+
if ($id) {
|
89 |
+
// Load record
|
90 |
+
$model->load($id);
|
91 |
+
|
92 |
+
// Check if record is loaded
|
93 |
+
if (!$model->getId()) {
|
94 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('This warehouse no longer exists.'));
|
95 |
+
$this->_redirect('*/*/');
|
96 |
+
|
97 |
+
return;
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
$this->_title($model->getId() ? $model->getName() : $this->__('New Warehouse'));
|
102 |
+
|
103 |
+
$data = Mage::getSingleton('adminhtml/session')->getBazData(true);
|
104 |
+
if (!empty($data)) {
|
105 |
+
$model->setData($data);
|
106 |
+
}
|
107 |
+
|
108 |
+
Mage::register('freightcenter_customware', $model);
|
109 |
+
|
110 |
+
$this->_initAction()
|
111 |
+
->_addBreadcrumb($id ? $this->__('Edit Warehouse') : $this->__('New Warehouse'), $id ? $this->__('Edit Warehouse') : $this->__('New Warehouse'))
|
112 |
+
->_addContent($this->getLayout()->createBlock('freightcenter_customware/adminhtml_collect_edit')->setData('action', $this->getUrl('*/*/save')))
|
113 |
+
->renderLayout();
|
114 |
+
}
|
115 |
+
|
116 |
+
public function saveAction()
|
117 |
+
{
|
118 |
+
if ($postData = $this->getRequest()->getPost()) {
|
119 |
+
//echo "<pre>";print_r($postData);exit;
|
120 |
+
if(isset($_POST['accessorials'])){
|
121 |
+
$accessorials = $_POST['accessorials'];
|
122 |
+
$all_acc = implode(',',$accessorials);
|
123 |
+
}
|
124 |
+
else{
|
125 |
+
$all_acc = '';
|
126 |
+
}
|
127 |
+
|
128 |
+
$model = Mage::getSingleton('freightcenter_customware/collect');
|
129 |
+
$model->setData($postData);
|
130 |
+
$model->setAccessorials($all_acc);
|
131 |
+
|
132 |
+
try {
|
133 |
+
$model->save();
|
134 |
+
|
135 |
+
$check = Mage::getModel('catalog/resource_eav_attribute')->loadByCode('catalog_product','origin_warehouse');
|
136 |
+
if($check->getId() != NULL) {
|
137 |
+
/* save option to warehouse attribute */
|
138 |
+
$lastid = $model->short_name;
|
139 |
+
$org_warehouse = Mage::getModel('eav/config')->getAttribute('catalog_product','origin_warehouse');
|
140 |
+
foreach ( $org_warehouse->getSource()->getAllOptions(true, true) as $optionmenu){
|
141 |
+
$warehouse_attribute[$optionmenu['label']] = $optionmenu['value'];
|
142 |
+
}
|
143 |
+
|
144 |
+
$warehouse_origin = $lastid;
|
145 |
+
/* add option values in manufacturer attribute */
|
146 |
+
$getprevoption = $warehouse_attribute[$warehouse_origin];
|
147 |
+
if(!$getprevoption) {
|
148 |
+
$arg_attribute = 'origin_warehouse';
|
149 |
+
$attribute_model = Mage::getModel('eav/entity_attribute');
|
150 |
+
|
151 |
+
$attribute_code = $attribute_model->getIdByCode('catalog_product', $arg_attribute);
|
152 |
+
$attribute = $attribute_model->load($attribute_code);
|
153 |
+
|
154 |
+
$val['option'] = array($warehouse_origin,$warehouse_origin);
|
155 |
+
$result = array('value' => $val);
|
156 |
+
$attribute->setData('option',$result);
|
157 |
+
$attribute->save();
|
158 |
+
}
|
159 |
+
}
|
160 |
+
|
161 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($this->__('The warehouse has been saved.'));
|
162 |
+
$this->_redirect('*/*/');
|
163 |
+
|
164 |
+
return;
|
165 |
+
}
|
166 |
+
catch (Mage_Core_Exception $e) {
|
167 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
168 |
+
}
|
169 |
+
catch (Exception $e) {
|
170 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('An error occurred while saving this warehouse.'));
|
171 |
+
}
|
172 |
+
|
173 |
+
Mage::getSingleton('adminhtml/session')->setBazData($postData);
|
174 |
+
$this->_redirectReferer();
|
175 |
+
}
|
176 |
+
}
|
177 |
+
|
178 |
+
public function deleteAction()
|
179 |
+
{
|
180 |
+
if ($id = $this->getRequest()->getParam('id')) {
|
181 |
+
|
182 |
+
$diog_collection = Mage::getModel('freightcenter_customware/collect')
|
183 |
+
->load($id);
|
184 |
+
$short_name = $diog_collection['short_name'];
|
185 |
+
|
186 |
+
try {
|
187 |
+
$diog_collection->delete();
|
188 |
+
|
189 |
+
$check = Mage::getModel('catalog/resource_eav_attribute')->loadByCode('catalog_product','origin_warehouse');
|
190 |
+
if($check->getId() != NULL) {
|
191 |
+
/* delete from warehouse attribute */
|
192 |
+
$org_warehouse = Mage::getModel('eav/config')->getAttribute('catalog_product','origin_warehouse');
|
193 |
+
$collection = Mage::getResourceModel('eav/entity_attribute_option_collection')
|
194 |
+
->setAttributeFilter($org_warehouse->getId())
|
195 |
+
->setStoreFilter($org_warehouse->getStoreId())
|
196 |
+
->load();
|
197 |
+
foreach ($collection as $option) {
|
198 |
+
$value = $option->value;
|
199 |
+
if($value == $short_name) {
|
200 |
+
$option->delete();
|
201 |
+
}
|
202 |
+
}
|
203 |
+
}
|
204 |
+
|
205 |
+
$this->_getSession()->addSuccess($this->__('The Warehouse has been deleted.'));
|
206 |
+
} catch (Exception $e) {
|
207 |
+
$this->_getSession()->addError($e->getMessage());
|
208 |
+
}
|
209 |
+
}
|
210 |
+
$this->_redirect('*/*/');
|
211 |
+
}
|
212 |
+
|
213 |
+
public function messageAction()
|
214 |
+
{
|
215 |
+
$data = Mage::getModel('freightcenter_customware/collect')->load($this->getRequest()->getParam('id'));
|
216 |
+
echo $data->getContent();
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* Initialize action
|
221 |
+
*
|
222 |
+
* Here, we set the breadcrumbs and the active menu
|
223 |
+
*
|
224 |
+
* @return Mage_Adminhtml_Controller_Action
|
225 |
+
*/
|
226 |
+
protected function _initAction()
|
227 |
+
{
|
228 |
+
$this->loadLayout()
|
229 |
+
// Make the active menu match the menu config nodes (without 'children' inbetween)
|
230 |
+
->_setActiveMenu('freightcenter_customware_collect')
|
231 |
+
->_title($this->__('Shipping Warehouses'))->_title($this->__('Warehouse'));
|
232 |
+
//->_addBreadcrumb($this->__('Sales'), $this->__('Sales'))
|
233 |
+
//->_addBreadcrumb($this->__('Baz'), $this->__('Baz'));
|
234 |
+
|
235 |
+
return $this;
|
236 |
+
}
|
237 |
+
|
238 |
+
/**
|
239 |
+
* Check currently called action by permissions for current user
|
240 |
+
*
|
241 |
+
* @return bool
|
242 |
+
*/
|
243 |
+
protected function _isAllowed()
|
244 |
+
{
|
245 |
+
return Mage::getSingleton('admin/session')->isAllowed('sales/freightcenter_customware_collect');
|
246 |
+
}
|
247 |
+
}
|
app/code/local/Freightcenter/CustomWare/controllers/Adminhtml/CollectController.php@1Aug
ADDED
@@ -0,0 +1,241 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Freightcenter_CustomWare_Adminhtml_CollectController extends Mage_Adminhtml_Controller_Action
|
3 |
+
{
|
4 |
+
public function _construct()
|
5 |
+
{
|
6 |
+
$check2 = Mage::getModel('catalog/resource_eav_attribute')->loadByCode('catalog_product','freight_class');
|
7 |
+
if($check2->getId() != NULL) {
|
8 |
+
/* add options to attribute */
|
9 |
+
$freightclasses = array('50','55','60','65','70','77.5','82','92.5','100','110','125','150','175','200','250','300','400','500');
|
10 |
+
/* add options to dropdown attribute */
|
11 |
+
$manufacturer = Mage::getModel('eav/config')->getAttribute('catalog_product','freight_class');
|
12 |
+
foreach ( $manufacturer->getSource()->getAllOptions(true, true) as $option_manu){
|
13 |
+
$manufacturer_attribute[$option_manu['label']] = $option_manu['value'];
|
14 |
+
}
|
15 |
+
|
16 |
+
foreach($freightclasses as $class) {
|
17 |
+
$manufacture = $class;
|
18 |
+
|
19 |
+
/* add option values in manufacturer attribute */
|
20 |
+
$getOption = $manufacturer_attribute[$manufacture];
|
21 |
+
if(!$getOption) {
|
22 |
+
$arg_attribute = 'freight_class';
|
23 |
+
$attribute_model = Mage::getModel('eav/entity_attribute');
|
24 |
+
|
25 |
+
$attribute_code = $attribute_model->getIdByCode('catalog_product', $arg_attribute);
|
26 |
+
$attribute = $attribute_model->load($attribute_code);
|
27 |
+
|
28 |
+
$val['option'] = array($manufacture,$manufacture);
|
29 |
+
$result = array('value' => $val);
|
30 |
+
$attribute->setData('option',$result);
|
31 |
+
$attribute->save();
|
32 |
+
}
|
33 |
+
}
|
34 |
+
}
|
35 |
+
|
36 |
+
$check9 = Mage::getModel('catalog/resource_eav_attribute')->loadByCode('catalog_product','packaging_type');
|
37 |
+
if($check9->getId() != NULL) {
|
38 |
+
$packagin_types = array('Boxed','Crated','Drums or Barrels','Palletized','Un-packaged');
|
39 |
+
/* add options to dropdown attribute */
|
40 |
+
$package_type = Mage::getModel('eav/config')->getAttribute('catalog_product','packaging_type');
|
41 |
+
foreach ( $package_type->getSource()->getAllOptions(true, true) as $option_menu){
|
42 |
+
$packaging_attribute[$option_menu['label']] = $option_menu['value'];
|
43 |
+
}
|
44 |
+
|
45 |
+
foreach($packagin_types as $types) {
|
46 |
+
$pkg_type = $types;
|
47 |
+
|
48 |
+
/* add option values in manufacturer attribute */
|
49 |
+
$getoption = $packaging_attribute[$pkg_type];
|
50 |
+
if(!$getoption) {
|
51 |
+
$arg_attribute = 'packaging_type';
|
52 |
+
$attribute_model = Mage::getModel('eav/entity_attribute');
|
53 |
+
|
54 |
+
$attribute_code = $attribute_model->getIdByCode('catalog_product', $arg_attribute);
|
55 |
+
$attribute = $attribute_model->load($attribute_code);
|
56 |
+
|
57 |
+
$val['option'] = array($pkg_type,$pkg_type);
|
58 |
+
$result = array('value' => $val);
|
59 |
+
$attribute->setData('option',$result);
|
60 |
+
$attribute->save();
|
61 |
+
}
|
62 |
+
}
|
63 |
+
}
|
64 |
+
/* end adding options */
|
65 |
+
}
|
66 |
+
|
67 |
+
public function indexAction()
|
68 |
+
{
|
69 |
+
// Let's call our initAction method which will set some basic params for each action
|
70 |
+
$this->_initAction()
|
71 |
+
->renderLayout();
|
72 |
+
}
|
73 |
+
|
74 |
+
public function newAction()
|
75 |
+
{
|
76 |
+
// We just forward the new action to a blank edit form
|
77 |
+
$this->_forward('edit');
|
78 |
+
}
|
79 |
+
|
80 |
+
public function editAction()
|
81 |
+
{
|
82 |
+
$this->_initAction();
|
83 |
+
|
84 |
+
// Get id if available
|
85 |
+
$id = $this->getRequest()->getParam('id');
|
86 |
+
$model = Mage::getModel('freightcenter_customware/collect');
|
87 |
+
|
88 |
+
if ($id) {
|
89 |
+
// Load record
|
90 |
+
$model->load($id);
|
91 |
+
|
92 |
+
// Check if record is loaded
|
93 |
+
if (!$model->getId()) {
|
94 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('This warehouse no longer exists.'));
|
95 |
+
$this->_redirect('*/*/');
|
96 |
+
|
97 |
+
return;
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
$this->_title($model->getId() ? $model->getName() : $this->__('New Warehouse'));
|
102 |
+
|
103 |
+
$data = Mage::getSingleton('adminhtml/session')->getBazData(true);
|
104 |
+
if (!empty($data)) {
|
105 |
+
$model->setData($data);
|
106 |
+
}
|
107 |
+
|
108 |
+
Mage::register('freightcenter_customware', $model);
|
109 |
+
|
110 |
+
$this->_initAction()
|
111 |
+
->_addBreadcrumb($id ? $this->__('Edit Warehouse') : $this->__('New Warehouse'), $id ? $this->__('Edit Warehouse') : $this->__('New Warehouse'))
|
112 |
+
->_addContent($this->getLayout()->createBlock('freightcenter_customware/adminhtml_collect_edit')->setData('action', $this->getUrl('*/*/save')))
|
113 |
+
->renderLayout();
|
114 |
+
}
|
115 |
+
|
116 |
+
public function saveAction()
|
117 |
+
{
|
118 |
+
if ($postData = $this->getRequest()->getPost()) {
|
119 |
+
//echo "<pre>";print_r($postData);exit;
|
120 |
+
$accessorials = $_POST['accessorials'];
|
121 |
+
$all_acc = implode(',',$accessorials);
|
122 |
+
|
123 |
+
$model = Mage::getSingleton('freightcenter_customware/collect');
|
124 |
+
$model->setData($postData);
|
125 |
+
$model->setAccessorials($all_acc);
|
126 |
+
|
127 |
+
try {
|
128 |
+
$model->save();
|
129 |
+
|
130 |
+
$check = Mage::getModel('catalog/resource_eav_attribute')->loadByCode('catalog_product','origin_warehouse');
|
131 |
+
if($check->getId() != NULL) {
|
132 |
+
/* save option to warehouse attribute */
|
133 |
+
$lastid = $model->short_name;
|
134 |
+
$org_warehouse = Mage::getModel('eav/config')->getAttribute('catalog_product','origin_warehouse');
|
135 |
+
foreach ( $org_warehouse->getSource()->getAllOptions(true, true) as $optionmenu){
|
136 |
+
$warehouse_attribute[$optionmenu['label']] = $optionmenu['value'];
|
137 |
+
}
|
138 |
+
|
139 |
+
$warehouse_origin = $lastid;
|
140 |
+
/* add option values in manufacturer attribute */
|
141 |
+
$getprevoption = $warehouse_attribute[$warehouse_origin];
|
142 |
+
if(!$getprevoption) {
|
143 |
+
$arg_attribute = 'origin_warehouse';
|
144 |
+
$attribute_model = Mage::getModel('eav/entity_attribute');
|
145 |
+
|
146 |
+
$attribute_code = $attribute_model->getIdByCode('catalog_product', $arg_attribute);
|
147 |
+
$attribute = $attribute_model->load($attribute_code);
|
148 |
+
|
149 |
+
$val['option'] = array($warehouse_origin,$warehouse_origin);
|
150 |
+
$result = array('value' => $val);
|
151 |
+
$attribute->setData('option',$result);
|
152 |
+
$attribute->save();
|
153 |
+
}
|
154 |
+
}
|
155 |
+
|
156 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($this->__('The warehouse has been saved.'));
|
157 |
+
$this->_redirect('*/*/');
|
158 |
+
|
159 |
+
return;
|
160 |
+
}
|
161 |
+
catch (Mage_Core_Exception $e) {
|
162 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
163 |
+
}
|
164 |
+
catch (Exception $e) {
|
165 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('An error occurred while saving this warehouse.'));
|
166 |
+
}
|
167 |
+
|
168 |
+
Mage::getSingleton('adminhtml/session')->setBazData($postData);
|
169 |
+
$this->_redirectReferer();
|
170 |
+
}
|
171 |
+
}
|
172 |
+
|
173 |
+
public function deleteAction()
|
174 |
+
{
|
175 |
+
if ($id = $this->getRequest()->getParam('id')) {
|
176 |
+
|
177 |
+
$diog_collection = Mage::getModel('freightcenter_customware/collect')
|
178 |
+
->load($id);
|
179 |
+
|
180 |
+
try {
|
181 |
+
$diog_collection->delete();
|
182 |
+
|
183 |
+
$check = Mage::getModel('catalog/resource_eav_attribute')->loadByCode('catalog_product','origin_warehouse');
|
184 |
+
if($check->getId() != NULL) {
|
185 |
+
/* delete from warehouse attribute */
|
186 |
+
$org_warehouse = Mage::getModel('eav/config')->getAttribute('catalog_product','origin_warehouse');
|
187 |
+
$collection = Mage::getResourceModel('eav/entity_attribute_option_collection')
|
188 |
+
->setAttributeFilter($org_warehouse->getId())
|
189 |
+
->setStoreFilter($org_warehouse->getStoreId())
|
190 |
+
->load();
|
191 |
+
foreach ($collection as $option) {
|
192 |
+
$value = $option->value;
|
193 |
+
if($value == $id) {
|
194 |
+
$option->delete();
|
195 |
+
}
|
196 |
+
}
|
197 |
+
}
|
198 |
+
|
199 |
+
$this->_getSession()->addSuccess($this->__('The Warehouse has been deleted.'));
|
200 |
+
} catch (Exception $e) {
|
201 |
+
$this->_getSession()->addError($e->getMessage());
|
202 |
+
}
|
203 |
+
}
|
204 |
+
$this->_redirect('*/*/');
|
205 |
+
}
|
206 |
+
|
207 |
+
public function messageAction()
|
208 |
+
{
|
209 |
+
$data = Mage::getModel('freightcenter_customware/collect')->load($this->getRequest()->getParam('id'));
|
210 |
+
echo $data->getContent();
|
211 |
+
}
|
212 |
+
|
213 |
+
/**
|
214 |
+
* Initialize action
|
215 |
+
*
|
216 |
+
* Here, we set the breadcrumbs and the active menu
|
217 |
+
*
|
218 |
+
* @return Mage_Adminhtml_Controller_Action
|
219 |
+
*/
|
220 |
+
protected function _initAction()
|
221 |
+
{
|
222 |
+
$this->loadLayout()
|
223 |
+
// Make the active menu match the menu config nodes (without 'children' inbetween)
|
224 |
+
->_setActiveMenu('freightcenter_customware_collect')
|
225 |
+
->_title($this->__('Shipping Warehouses'))->_title($this->__('Warehouse'));
|
226 |
+
//->_addBreadcrumb($this->__('Sales'), $this->__('Sales'))
|
227 |
+
//->_addBreadcrumb($this->__('Baz'), $this->__('Baz'));
|
228 |
+
|
229 |
+
return $this;
|
230 |
+
}
|
231 |
+
|
232 |
+
/**
|
233 |
+
* Check currently called action by permissions for current user
|
234 |
+
*
|
235 |
+
* @return bool
|
236 |
+
*/
|
237 |
+
protected function _isAllowed()
|
238 |
+
{
|
239 |
+
return Mage::getSingleton('admin/session')->isAllowed('sales/freightcenter_customware_collect');
|
240 |
+
}
|
241 |
+
}
|
app/code/local/Freightcenter/CustomWare/etc/adminhtml.xml
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<menu>
|
4 |
+
<!--
|
5 |
+
This item will be created in the Admin menu under Sales
|
6 |
+
- If you want another section, reference the appropriate adminhtml.xml file in app/code/core/Mage/Modulename/etc
|
7 |
+
- For example, we found out this was 'sales' by referencing the config/menu node of app/code/core/Mage/Sales/etc/adminhtml.xml
|
8 |
+
-->
|
9 |
+
<freightcenter_customware_collect translate="title" module="freightcenter_customware">
|
10 |
+
<!-- This is how the menu text will be displayed -->
|
11 |
+
<title>Shipping Warehouses</title>
|
12 |
+
<sort_order>101</sort_order>
|
13 |
+
<children>
|
14 |
+
<!-- Keep the same naming convention as above -->
|
15 |
+
<freightcenter_customware_collect>
|
16 |
+
<!-- This is how the ACL text will be displayed on System > Permissions > Roles > Role > Role Resources -->
|
17 |
+
<title>All Warehouses</title>
|
18 |
+
<!-- This is the URL of what we want the menu item to link to -->
|
19 |
+
<action>adminhtml/collect</action>
|
20 |
+
</freightcenter_customware_collect>
|
21 |
+
</children>
|
22 |
+
</freightcenter_customware_collect>
|
23 |
+
</menu>
|
24 |
+
|
25 |
+
<acl>
|
26 |
+
<resources>
|
27 |
+
<admin>
|
28 |
+
<children>
|
29 |
+
<!-- Same as above, but instead of referencing the config/menu node, you reference the acl/resources node of adminhtml.xml -->
|
30 |
+
<sales>
|
31 |
+
<children>
|
32 |
+
<!-- Keep the same naming convention as above -->
|
33 |
+
<freightcenter_customware_collect>
|
34 |
+
<!-- This is how the ACL text will be displayed on System > Permissions > Roles > Role > Role Resources -->
|
35 |
+
<title>Collect</title>
|
36 |
+
</freightcenter_customware_collect>
|
37 |
+
</children>
|
38 |
+
</sales>
|
39 |
+
</children>
|
40 |
+
</admin>
|
41 |
+
</resources>
|
42 |
+
</acl>
|
43 |
+
</config>
|
app/code/local/Freightcenter/CustomWare/etc/config.xml
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Freightcenter_CustomWare>
|
5 |
+
<version>1.0.0</version>
|
6 |
+
</Freightcenter_CustomWare>
|
7 |
+
</modules>
|
8 |
+
|
9 |
+
<global>
|
10 |
+
<helpers>
|
11 |
+
<freightcenter_customware>
|
12 |
+
<!-- This is where we define our helper directory -->
|
13 |
+
<class>Freightcenter_CustomWare_Helper</class>
|
14 |
+
</freightcenter_customware>
|
15 |
+
</helpers>
|
16 |
+
|
17 |
+
<blocks>
|
18 |
+
<freightcenter_customware>
|
19 |
+
<!-- Set a block definition and lookup directory -->
|
20 |
+
<class>Freightcenter_CustomWare_Block</class>
|
21 |
+
</freightcenter_customware>
|
22 |
+
</blocks>
|
23 |
+
|
24 |
+
<models>
|
25 |
+
<freightcenter_customware>
|
26 |
+
<!-- This is where we define our model directory -->
|
27 |
+
<class>Freightcenter_CustomWare_Model</class>
|
28 |
+
<!-- Define a resource to create a custom table -->
|
29 |
+
<resourceModel>freightcenter_customware_mysql4</resourceModel>
|
30 |
+
</freightcenter_customware>
|
31 |
+
|
32 |
+
<!-- Here's our resource model we'll use to create a database table -->
|
33 |
+
<freightcenter_customware_mysql4>
|
34 |
+
<class>Freightcenter_CustomWare_Model_Mysql4</class>
|
35 |
+
<entities>
|
36 |
+
<!-- Let's define our table, we'll call it with the baz name, but the real table is foo_bar_baz -->
|
37 |
+
<!-- After we define our entity, we can call it with our model by calling foo_bar/baz -->
|
38 |
+
<collect>
|
39 |
+
<table>brst_ship_warehouses</table>
|
40 |
+
</collect>
|
41 |
+
</entities>
|
42 |
+
</freightcenter_customware_mysql4>
|
43 |
+
</models>
|
44 |
+
|
45 |
+
<!-- And finally we define our resource setup script -->
|
46 |
+
<resources>
|
47 |
+
<freightcenter_customware_setup>
|
48 |
+
<setup>
|
49 |
+
<module>Freightcenter_CustomWare</module>
|
50 |
+
</setup>
|
51 |
+
</freightcenter_customware_setup>
|
52 |
+
</resources>
|
53 |
+
</global>
|
54 |
+
|
55 |
+
<admin>
|
56 |
+
<routers>
|
57 |
+
<adminhtml>
|
58 |
+
<args>
|
59 |
+
<!-- This is how we load our Adminhtml controllers -->
|
60 |
+
<modules>
|
61 |
+
<Freightcenter_CustomWare before="Mage_Adminhtml">Freightcenter_CustomWare_Adminhtml</Freightcenter_CustomWare>
|
62 |
+
</modules>
|
63 |
+
</args>
|
64 |
+
</adminhtml>
|
65 |
+
</routers>
|
66 |
+
</admin>
|
67 |
+
|
68 |
+
<adminhtml>
|
69 |
+
<layout>
|
70 |
+
<updates>
|
71 |
+
<freightcenter_customware>
|
72 |
+
<!--
|
73 |
+
We again keep a nice naming convention and make our module upgrade proof by placing it in a separate folder
|
74 |
+
- Since we are in the adminhtml node, this will look for the XML file in the app/design/adminhtml/default/default root folder
|
75 |
+
-->
|
76 |
+
<file>freightcenter/customware.xml</file>
|
77 |
+
</freightcenter_customware>
|
78 |
+
</updates>
|
79 |
+
</layout>
|
80 |
+
</adminhtml>
|
81 |
+
</config>
|
app/code/local/Freightcenter/CustomWare/sql/freightcenter_customware_setup/mysql4-install-1.0.0.php
ADDED
@@ -0,0 +1,315 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/* delete tables from database if exists */
|
4 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
5 |
+
$warehouse_table = "Drop table if exists `brst_ship_warehouses`";
|
6 |
+
$connection->query($warehouse_table);
|
7 |
+
|
8 |
+
$carriers_table = "Drop table if exists `brst_freight_carriers`";
|
9 |
+
$connection->query($carriers_table);
|
10 |
+
|
11 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
12 |
+
$installer = $this;
|
13 |
+
$installer->startSetup();
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Create table 'brst_ship_warehouses'
|
17 |
+
*/
|
18 |
+
$table = $installer->getConnection()
|
19 |
+
// The following call to getTable('foo_bar/baz') will lookup the resource for foo_bar (foo_bar_mysql4), and look
|
20 |
+
// for a corresponding entity called baz. The table name in the XML is foo_bar_baz, so ths is what is created.
|
21 |
+
->newTable($installer->getTable('brst_ship_warehouses'))
|
22 |
+
->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
23 |
+
'identity' => true,
|
24 |
+
'unsigned' => true,
|
25 |
+
'nullable' => false,
|
26 |
+
'primary' => true,
|
27 |
+
), 'ID')
|
28 |
+
->addColumn('short_name', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
29 |
+
'nullable' => false,
|
30 |
+
), 'Short Name')
|
31 |
+
->addColumn('cmpny_name', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
32 |
+
'nullable' => false,
|
33 |
+
), 'Company Name')
|
34 |
+
->addColumn('cmpny_postcode', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
35 |
+
'nullable' => false,
|
36 |
+
), 'Company PostCode')
|
37 |
+
->addColumn('address', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
38 |
+
'nullable' => false,
|
39 |
+
), 'address')
|
40 |
+
->addColumn('street', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
41 |
+
'nullable' => false,
|
42 |
+
), 'street')
|
43 |
+
->addColumn('city', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
44 |
+
'nullable' => false,
|
45 |
+
), 'city')
|
46 |
+
->addColumn('state', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
47 |
+
'nullable' => false,
|
48 |
+
), 'state')
|
49 |
+
->addColumn('country_id', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
50 |
+
'nullable' => false,
|
51 |
+
), 'country_id')
|
52 |
+
->addColumn('first_name', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
53 |
+
'nullable' => false,
|
54 |
+
), 'first_name')
|
55 |
+
->addColumn('last_name', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
56 |
+
'nullable' => false,
|
57 |
+
), 'last_name')
|
58 |
+
->addColumn('phone', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
59 |
+
'nullable' => false,
|
60 |
+
), 'phone')
|
61 |
+
->addColumn('email', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
62 |
+
'nullable' => false,
|
63 |
+
), 'email')
|
64 |
+
->addColumn('accessorials', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
65 |
+
'nullable' => false,
|
66 |
+
), 'accessorials')
|
67 |
+
->addColumn('location_type', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
68 |
+
'nullable' => false,
|
69 |
+
), 'location_type')
|
70 |
+
->addColumn('hours', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
71 |
+
'nullable' => false,
|
72 |
+
), 'hours');
|
73 |
+
|
74 |
+
$installer->getConnection()->createTable($table);
|
75 |
+
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Create table 'brst_freight_carriers'
|
79 |
+
*/
|
80 |
+
$table1 = $installer->getConnection()
|
81 |
+
// The following call to getTable('foo_bar/baz') will lookup the resource for foo_bar (foo_bar_mysql4), and look
|
82 |
+
// for a corresponding entity called baz. The table name in the XML is foo_bar_baz, so ths is what is created.
|
83 |
+
->newTable($installer->getTable('brst_freight_carriers'))
|
84 |
+
->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
85 |
+
'identity' => true,
|
86 |
+
'unsigned' => true,
|
87 |
+
'nullable' => false,
|
88 |
+
'primary' => true,
|
89 |
+
), 'ID')
|
90 |
+
->addColumn('username', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
91 |
+
'nullable' => false,
|
92 |
+
), 'username')
|
93 |
+
->addColumn('carrierid', Varien_Db_Ddl_Table::TYPE_INTEGER, 0, array(
|
94 |
+
'nullable' => false,
|
95 |
+
), 'carrierid')
|
96 |
+
->addColumn('carrier_scac', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
97 |
+
'nullable' => false,
|
98 |
+
), 'carrier_scac')
|
99 |
+
->addColumn('carrier_code', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
100 |
+
'nullable' => false,
|
101 |
+
), 'carrier_code')
|
102 |
+
->addColumn('carrier_name', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
103 |
+
'nullable' => false,
|
104 |
+
), 'carrier_name');
|
105 |
+
|
106 |
+
$installer->getConnection()->createTable($table1);
|
107 |
+
|
108 |
+
$installer->endSetup();
|
109 |
+
$table3 = $installer->getConnection()
|
110 |
+
// The following call to getTable('foo_bar/baz') will lookup the resource for foo_bar (foo_bar_mysql4), and look
|
111 |
+
// for a corresponding entity called baz. The table name in the XML is foo_bar_baz, so ths is what is created.
|
112 |
+
->newTable($installer->getTable('brst_freight_shipping'))
|
113 |
+
->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
114 |
+
'identity' => true,
|
115 |
+
'unsigned' => true,
|
116 |
+
'nullable' => false,
|
117 |
+
'primary' => true,
|
118 |
+
), 'ID')
|
119 |
+
->addColumn('product_id', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
120 |
+
'nullable' => false,
|
121 |
+
), 'Product Id')
|
122 |
+
->addColumn('shipping_charge', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
123 |
+
'nullable' => false,
|
124 |
+
), 'Shipping Charge')
|
125 |
+
->addColumn('quote_id', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
126 |
+
'nullable' => false,
|
127 |
+
), 'Quote Id')
|
128 |
+
->addColumn('carrier_name', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
129 |
+
'nullable' => false,
|
130 |
+
), 'Carrier Name')
|
131 |
+
->addColumn('bookingno', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
132 |
+
'nullable' => false,
|
133 |
+
), 'Booking No')
|
134 |
+
->addColumn('status', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
135 |
+
'nullable' => false,
|
136 |
+
), 'Status')
|
137 |
+
->addColumn('date_from', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
138 |
+
'nullable' => false,
|
139 |
+
), 'Date From')
|
140 |
+
->addColumn('date_to', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
141 |
+
'nullable' => false,
|
142 |
+
), 'Date TO')
|
143 |
+
->addColumn('final_dest', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
144 |
+
'nullable' => false,
|
145 |
+
), 'Final Destination')
|
146 |
+
->addColumn('rateid', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
147 |
+
'nullable' => false,
|
148 |
+
), 'RATEID')
|
149 |
+
->addColumn('warehouse_name', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
150 |
+
'nullable' => false,
|
151 |
+
), 'warehouse_name')
|
152 |
+
->addColumn('days', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
153 |
+
'nullable' => false,
|
154 |
+
), 'days')
|
155 |
+
->addColumn('grandship', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
156 |
+
'nullable' => false,
|
157 |
+
), 'grandship')
|
158 |
+
->addColumn('mark', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
159 |
+
'nullable' => false,
|
160 |
+
), 'mark');
|
161 |
+
|
162 |
+
$installer->getConnection()->createTable($table3);
|
163 |
+
|
164 |
+
$installer->endSetup();
|
165 |
+
|
166 |
+
|
167 |
+
/* create new attribute group */
|
168 |
+
$groups = Mage::getModel('eav/entity_attribute_group')->getCollection()->getData();
|
169 |
+
foreach($groups as $grp) {
|
170 |
+
$all_groups[] = $grp['attribute_group_name'];
|
171 |
+
}
|
172 |
+
|
173 |
+
if(!in_array('Freight Shipping',$all_groups)) {
|
174 |
+
$modelGroup = Mage::getModel('eav/entity_attribute_group');
|
175 |
+
$modelGroup->setAttributeGroupName('Freight Shipping')
|
176 |
+
->setAttributeSetId('4')
|
177 |
+
->setSortOrder(100);
|
178 |
+
$modelGroup->save();
|
179 |
+
}
|
180 |
+
|
181 |
+
|
182 |
+
/* create product attributes */
|
183 |
+
function createAttribute($code, $label, $attribute_type, $product_type, $attribute_set_name, $group_name )
|
184 |
+
{
|
185 |
+
$_attribute_data = array(
|
186 |
+
'attribute_code' => $code,
|
187 |
+
'is_global' => '1',
|
188 |
+
'frontend_input' => $attribute_type, //'boolean',
|
189 |
+
'default_value_text' => '',
|
190 |
+
'default_value_yesno' => '0',
|
191 |
+
'default_value_date' => '',
|
192 |
+
'default_value_textarea' => '',
|
193 |
+
'is_unique' => '0',
|
194 |
+
'is_required' => '0',
|
195 |
+
'apply_to' => array($product_type), //array('grouped')
|
196 |
+
'is_configurable' => '0',
|
197 |
+
'is_searchable' => '0',
|
198 |
+
'is_visible_in_advanced_search' => '0',
|
199 |
+
'is_comparable' => '0',
|
200 |
+
'is_used_for_price_rules' => '0',
|
201 |
+
'is_wysiwyg_enabled' => '0',
|
202 |
+
'is_html_allowed_on_front' => '1',
|
203 |
+
'is_visible_on_front' => '0',
|
204 |
+
'used_in_product_listing' => '0',
|
205 |
+
'used_for_sort_by' => '0',
|
206 |
+
'frontend_label' => array($label)
|
207 |
+
);
|
208 |
+
|
209 |
+
$model = Mage::getModel('catalog/resource_eav_attribute');
|
210 |
+
|
211 |
+
if (!isset($_attribute_data['is_configurable'])) {
|
212 |
+
$_attribute_data['is_configurable'] = 0;
|
213 |
+
}
|
214 |
+
if (!isset($_attribute_data['is_filterable'])) {
|
215 |
+
$_attribute_data['is_filterable'] = 0;
|
216 |
+
}
|
217 |
+
if (!isset($_attribute_data['is_filterable_in_search'])) {
|
218 |
+
$_attribute_data['is_filterable_in_search'] = 0;
|
219 |
+
}
|
220 |
+
|
221 |
+
if (is_null($model->getIsUserDefined()) || $model->getIsUserDefined() != 0) {
|
222 |
+
$_attribute_data['backend_type'] = $model->getBackendTypeByInput($_attribute_data['frontend_input']);
|
223 |
+
}
|
224 |
+
|
225 |
+
$defaultValueField = $model->getDefaultValueByInput($_attribute_data['frontend_input']);
|
226 |
+
if ($defaultValueField) {
|
227 |
+
// $_attribute_data['default_value'] = $this->getRequest()->getParam($defaultValueField);
|
228 |
+
}
|
229 |
+
|
230 |
+
$model->addData($_attribute_data);
|
231 |
+
|
232 |
+
$model->setEntityTypeId(Mage::getModel('eav/entity')->setType('catalog_product')->getTypeId());
|
233 |
+
$model->setIsUserDefined(1);
|
234 |
+
try {
|
235 |
+
$model->save();
|
236 |
+
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
|
237 |
+
//-------------- add attribute to set and group
|
238 |
+
|
239 |
+
$attribute_code = $code;
|
240 |
+
|
241 |
+
$attribute_set_id=$setup->getAttributeSetId('catalog_product', $attribute_set_name);
|
242 |
+
$attribute_group_id=$setup->getAttributeGroupId('catalog_product', $attribute_set_id, $group_name);
|
243 |
+
$attribute_id=$setup->getAttributeId('catalog_product', $attribute_code);
|
244 |
+
|
245 |
+
$setup->addAttributeToSet($entityTypeId='catalog_product',$attribute_set_id, $attribute_group_id, $attribute_id);
|
246 |
+
|
247 |
+
} catch (Exception $e) { echo '<p>Sorry, error occured while trying to save the attribute. Error: '.$e->getMessage().'</p>'; }
|
248 |
+
}
|
249 |
+
|
250 |
+
|
251 |
+
$attribute_set_name="Default"; //attribute set name
|
252 |
+
$group_name="Freight Shipping"; //Inside attribue set you will get groups ex:- General, prices etc
|
253 |
+
|
254 |
+
/* ship via freight */
|
255 |
+
$check = Mage::getModel('catalog/resource_eav_attribute')->loadByCode('catalog_product','ship_via_freight');
|
256 |
+
if($check->getId() == NULL) {
|
257 |
+
createAttribute(strtolower(str_replace(" ", "_", 'Ship via freight')),'Ship this item via freight',"boolean","simple",$attribute_set_name,$group_name);
|
258 |
+
}
|
259 |
+
|
260 |
+
/* freight class */
|
261 |
+
$check2 = Mage::getModel('catalog/resource_eav_attribute')->loadByCode('catalog_product','freight_class');
|
262 |
+
if($check2->getId() == NULL) {
|
263 |
+
$attr_code = 'Freight Class';
|
264 |
+
createAttribute(strtolower(str_replace(" ", "_", $attr_code)), "$attr_code", "select", "simple", $attribute_set_name,$group_name);
|
265 |
+
}
|
266 |
+
|
267 |
+
/* NMFC */
|
268 |
+
$check3 = Mage::getModel('catalog/resource_eav_attribute')->loadByCode('catalog_product','NMFC');
|
269 |
+
if($check3->getId() == NULL) {
|
270 |
+
createAttribute(strtolower(str_replace(" ", "_", 'NMFC')),'NMFC',"text","simple",$attribute_set_name,$group_name);
|
271 |
+
}
|
272 |
+
|
273 |
+
/* Length */
|
274 |
+
$check4 = Mage::getModel('catalog/resource_eav_attribute')->loadByCode('catalog_product','freight_length');
|
275 |
+
if($check4->getId() == NULL) {
|
276 |
+
createAttribute(strtolower(str_replace(" ", "_", 'freight_length')),'Length (inches)',"text","simple",$attribute_set_name,$group_name);
|
277 |
+
}
|
278 |
+
|
279 |
+
/* Width */
|
280 |
+
$check5 = Mage::getModel('catalog/resource_eav_attribute')->loadByCode('catalog_product','freight_width');
|
281 |
+
if($check5->getId() == NULL) {
|
282 |
+
createAttribute(strtolower(str_replace(" ", "_", 'freight_width')),'Width (inches)',"text","simple",$attribute_set_name,$group_name);
|
283 |
+
}
|
284 |
+
|
285 |
+
/* Height */
|
286 |
+
$check6 = Mage::getModel('catalog/resource_eav_attribute')->loadByCode('catalog_product','freight_height');
|
287 |
+
if($check6->getId() == NULL) {
|
288 |
+
createAttribute(strtolower(str_replace(" ", "_", 'freight_height')),'Height (inches)',"text","simple",$attribute_set_name,$group_name);
|
289 |
+
}
|
290 |
+
|
291 |
+
/* weight */
|
292 |
+
//$check7 = Mage::getModel('catalog/resource_eav_attribute')->loadByCode('catalog_product','freight_weight');
|
293 |
+
//if($check7->getId() == NULL) {
|
294 |
+
// createAttribute(strtolower(str_replace(" ", "_", 'freight_weight')),'Weight',"text","simple",$attribute_set_name,$group_name);
|
295 |
+
//}
|
296 |
+
|
297 |
+
/* ship via freight */
|
298 |
+
/* $check8 = Mage::getModel('catalog/resource_eav_attribute')->loadByCode('catalog_product','hazardous_materials');
|
299 |
+
if($check8->getId() == NULL) {
|
300 |
+
createAttribute(strtolower(str_replace(" ", "_", 'Hazardous Materials')),'Hazardous Materials',"boolean","simple",$attribute_set_name,$group_name);
|
301 |
+
} */
|
302 |
+
|
303 |
+
/* packaging types */
|
304 |
+
/* $check9 = Mage::getModel('catalog/resource_eav_attribute')->loadByCode('catalog_product','packaging_type');
|
305 |
+
if($check9->getId() == NULL) {
|
306 |
+
$attr_code = 'Packaging Type';
|
307 |
+
createAttribute(strtolower(str_replace(" ", "_", $attr_code)), "$attr_code", "select", "simple", $attribute_set_name,$group_name);
|
308 |
+
} */
|
309 |
+
|
310 |
+
/* origin warehouse */
|
311 |
+
$check7 = Mage::getModel('catalog/resource_eav_attribute')->loadByCode('catalog_product','origin_warehouse');
|
312 |
+
if($check7->getId() == NULL) {
|
313 |
+
$attr_code = 'Origin Warehouse';
|
314 |
+
createAttribute(strtolower(str_replace(" ", "_", $attr_code)), "$attr_code", "select", "simple", $attribute_set_name,$group_name);
|
315 |
+
}
|
app/code/local/Freightcenter/Frieghtadmin/Block/Adminhtml/Order/View/Tab/Frieghtadmin.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Freightcenter_Frieghtadmin_Block_Adminhtml_Order_View_Tab_Frieghtadmin
|
3 |
+
extends Mage_Adminhtml_Block_Template
|
4 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
5 |
+
{
|
6 |
+
protected function _construct()
|
7 |
+
{
|
8 |
+
parent::_construct();
|
9 |
+
$this->setTemplate('freightcenter/frieghtadmin/order/view/tab/frieghtadmin.phtml');
|
10 |
+
}
|
11 |
+
|
12 |
+
public function getTabLabel() {
|
13 |
+
return $this->__('Frieght Admin');
|
14 |
+
}
|
15 |
+
|
16 |
+
public function getTabTitle() {
|
17 |
+
return $this->__('Frieght Admin');
|
18 |
+
}
|
19 |
+
|
20 |
+
public function canShowTab() {
|
21 |
+
return true;
|
22 |
+
}
|
23 |
+
|
24 |
+
public function isHidden() {
|
25 |
+
return false;
|
26 |
+
}
|
27 |
+
|
28 |
+
public function getOrder(){
|
29 |
+
return Mage::registry('current_order');
|
30 |
+
}
|
31 |
+
}
|
32 |
+
?>
|
app/code/local/Freightcenter/Frieghtadmin/Block/Adminhtml/Sales/Order/View/Frieghtadmin.php
ADDED
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Adminhtml
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Order history block
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_Adminhtml
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Freightcenter_Frieghtadmin_Block_Adminhtml_Sales_Order_View_Frieghtadmin extends Mage_Adminhtml_Block_Sales_Order_Abstract
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Retrieve required options from parent
|
38 |
+
*/
|
39 |
+
protected function _beforeToHtml()
|
40 |
+
{
|
41 |
+
if (!$this->getParentBlock()) {
|
42 |
+
Mage::throwException(Mage::helper('adminhtml')->__('Invalid parent block for this block.'));
|
43 |
+
}
|
44 |
+
$this->setOrder($this->getParentBlock()->getOrder());
|
45 |
+
|
46 |
+
foreach ($this->getParentBlock()->getOrderInfoData() as $k => $v) {
|
47 |
+
$this->setDataUsingMethod($k, $v);
|
48 |
+
}
|
49 |
+
|
50 |
+
parent::_beforeToHtml();
|
51 |
+
}
|
52 |
+
|
53 |
+
public function getOrderStoreName()
|
54 |
+
{
|
55 |
+
if ($this->getOrder()) {
|
56 |
+
$storeId = $this->getOrder()->getStoreId();
|
57 |
+
if (is_null($storeId)) {
|
58 |
+
$deleted = Mage::helper('adminhtml')->__(' [deleted]');
|
59 |
+
return nl2br($this->getOrder()->getStoreName()) . $deleted;
|
60 |
+
}
|
61 |
+
$store = Mage::app()->getStore($storeId);
|
62 |
+
$name = array(
|
63 |
+
$store->getWebsite()->getName(),
|
64 |
+
$store->getGroup()->getName(),
|
65 |
+
$store->getName()
|
66 |
+
);
|
67 |
+
return implode('<br/>', $name);
|
68 |
+
}
|
69 |
+
return null;
|
70 |
+
}
|
71 |
+
|
72 |
+
public function getCustomerGroupName()
|
73 |
+
{
|
74 |
+
if ($this->getOrder()) {
|
75 |
+
return Mage::getModel('customer/group')->load((int)$this->getOrder()->getCustomerGroupId())->getCode();
|
76 |
+
}
|
77 |
+
return null;
|
78 |
+
}
|
79 |
+
|
80 |
+
public function getCustomerViewUrl()
|
81 |
+
{
|
82 |
+
if ($this->getOrder()->getCustomerIsGuest() || !$this->getOrder()->getCustomerId()) {
|
83 |
+
return false;
|
84 |
+
}
|
85 |
+
return $this->getUrl('*/customer/edit', array('id' => $this->getOrder()->getCustomerId()));
|
86 |
+
}
|
87 |
+
|
88 |
+
public function getViewUrl($orderId)
|
89 |
+
{
|
90 |
+
return $this->getUrl('*/sales_order/view', array('order_id'=>$orderId));
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Find sort order for account data
|
95 |
+
* Sort Order used as array key
|
96 |
+
*
|
97 |
+
* @param array $data
|
98 |
+
* @param int $sortOrder
|
99 |
+
* @return int
|
100 |
+
*/
|
101 |
+
protected function _prepareAccountDataSortOrder(array $data, $sortOrder)
|
102 |
+
{
|
103 |
+
if (isset($data[$sortOrder])) {
|
104 |
+
return $this->_prepareAccountDataSortOrder($data, $sortOrder + 1);
|
105 |
+
}
|
106 |
+
return $sortOrder;
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Return array of additional account data
|
111 |
+
* Value is option style array
|
112 |
+
*
|
113 |
+
* @return array
|
114 |
+
*/
|
115 |
+
public function getCustomerAccountData()
|
116 |
+
{
|
117 |
+
$accountData = array();
|
118 |
+
|
119 |
+
/* @var $config Mage_Eav_Model_Config */
|
120 |
+
$config = Mage::getSingleton('eav/config');
|
121 |
+
$entityType = 'customer';
|
122 |
+
$customer = Mage::getModel('customer/customer');
|
123 |
+
foreach ($config->getEntityAttributeCodes($entityType) as $attributeCode) {
|
124 |
+
/* @var $attribute Mage_Customer_Model_Attribute */
|
125 |
+
$attribute = $config->getAttribute($entityType, $attributeCode);
|
126 |
+
if (!$attribute->getIsVisible() || $attribute->getIsSystem()) {
|
127 |
+
continue;
|
128 |
+
}
|
129 |
+
$orderKey = sprintf('customer_%s', $attribute->getAttributeCode());
|
130 |
+
$orderValue = $this->getOrder()->getData($orderKey);
|
131 |
+
if ($orderValue != '') {
|
132 |
+
$customer->setData($attribute->getAttributeCode(), $orderValue);
|
133 |
+
$dataModel = Mage_Customer_Model_Attribute_Data::factory($attribute, $customer);
|
134 |
+
$value = $dataModel->outputValue(Mage_Customer_Model_Attribute_Data::OUTPUT_FORMAT_HTML);
|
135 |
+
$sortOrder = $attribute->getSortOrder() + $attribute->getIsUserDefined() ? 200 : 0;
|
136 |
+
$sortOrder = $this->_prepareAccountDataSortOrder($accountData, $sortOrder);
|
137 |
+
$accountData[$sortOrder] = array(
|
138 |
+
'label' => $attribute->getFrontendLabel(),
|
139 |
+
'value' => $this->escapeHtml($value, array('br'))
|
140 |
+
);
|
141 |
+
}
|
142 |
+
}
|
143 |
+
|
144 |
+
ksort($accountData, SORT_NUMERIC);
|
145 |
+
|
146 |
+
return $accountData;
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Get link to edit order address page
|
151 |
+
*
|
152 |
+
* @param Mage_Sales_Model_Order_Address $address
|
153 |
+
* @param string $label
|
154 |
+
* @return string
|
155 |
+
*/
|
156 |
+
public function getAddressEditLink($address, $label='')
|
157 |
+
{
|
158 |
+
if (empty($label)) {
|
159 |
+
$label = $this->__('Edit');
|
160 |
+
}
|
161 |
+
$url = $this->getUrl('*/sales_order/address', array('address_id'=>$address->getId()));
|
162 |
+
return '<a href="'.$url.'">' . $label . '</a>';
|
163 |
+
}
|
164 |
+
|
165 |
+
/**
|
166 |
+
* Whether Customer IP address should be displayed on sales documents
|
167 |
+
* @return bool
|
168 |
+
*/
|
169 |
+
public function shouldDisplayCustomerIp()
|
170 |
+
{
|
171 |
+
return !Mage::getStoreConfigFlag('sales/general/hide_customer_ip', $this->getOrder()->getStoreId());
|
172 |
+
}
|
173 |
+
}
|
app/code/local/Freightcenter/Frieghtadmin/Block/Adminhtml/Sales/Order/View/Tab/Frieghtadmin.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Freightcenter_Frieghtadmin_Block_Adminhtml_Sales_Order_View_Tab_Frieghtadmin
|
3 |
+
extends Mage_Adminhtml_Block_Sales_Order_Abstract
|
4 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
5 |
+
{
|
6 |
+
protected function _construct()
|
7 |
+
{
|
8 |
+
//die('here');
|
9 |
+
parent::_construct();
|
10 |
+
$this->setTemplate('freightcenter/frieghtadmin/sales/order/view/tab/frieghtadmin.phtml');
|
11 |
+
}
|
12 |
+
public function getOrderTotalData()
|
13 |
+
{
|
14 |
+
return array(
|
15 |
+
'can_display_total_due' => true,
|
16 |
+
'can_display_total_paid' => true,
|
17 |
+
'can_display_total_refunded' => true,
|
18 |
+
);
|
19 |
+
}
|
20 |
+
public function getSource()
|
21 |
+
{
|
22 |
+
return $this->getOrder();
|
23 |
+
}
|
24 |
+
public function getOrderInfoData()
|
25 |
+
{
|
26 |
+
return array(
|
27 |
+
'no_use_order_link' => true,
|
28 |
+
);
|
29 |
+
}
|
30 |
+
public function getViewUrl($orderId)
|
31 |
+
{
|
32 |
+
return $this->getUrl('*/*/*', array('order_id'=>$orderId));
|
33 |
+
}
|
34 |
+
public function getTrackingHtml()
|
35 |
+
{
|
36 |
+
return $this->getChildHtml('order_tracking');
|
37 |
+
}
|
38 |
+
public function getItemsHtml()
|
39 |
+
{
|
40 |
+
return $this->getChildHtml('order_items');
|
41 |
+
}
|
42 |
+
public function getPaymentHtml()
|
43 |
+
{
|
44 |
+
return $this->getChildHtml('order_payment');
|
45 |
+
}
|
46 |
+
|
47 |
+
public function getTabLabel() {
|
48 |
+
return $this->__('Freight Admin');
|
49 |
+
}
|
50 |
+
|
51 |
+
public function getTabTitle() {
|
52 |
+
return $this->__('Freight Admin');
|
53 |
+
}
|
54 |
+
|
55 |
+
public function canShowTab() {
|
56 |
+
return true;
|
57 |
+
}
|
58 |
+
|
59 |
+
public function isHidden() {
|
60 |
+
return false;
|
61 |
+
}
|
62 |
+
|
63 |
+
public function getOrder(){
|
64 |
+
return Mage::registry('current_order');
|
65 |
+
}
|
66 |
+
}
|
67 |
+
?>
|
app/code/local/Freightcenter/Frieghtadmin/etc/config.xml
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Freightcenter_Frieghtadmin>
|
5 |
+
<version>1.0.1</version>
|
6 |
+
</Freightcenter_Frieghtadmin>
|
7 |
+
</modules>
|
8 |
+
|
9 |
+
<global>
|
10 |
+
<blocks>
|
11 |
+
<frieghtadmin>
|
12 |
+
<class>Freightcenter_Frieghtadmin_Block</class>
|
13 |
+
</frieghtadmin>
|
14 |
+
</blocks>
|
15 |
+
</global>
|
16 |
+
<adminhtml>
|
17 |
+
<layout>
|
18 |
+
<updates>
|
19 |
+
<frieghtadmin>
|
20 |
+
<file>freightcenter_frieghtadmin.xml</file>
|
21 |
+
</frieghtadmin>
|
22 |
+
</updates>
|
23 |
+
</layout>
|
24 |
+
</adminhtml>
|
25 |
+
</config>
|
app/code/local/Freightcenter/Frieghtadmin/sql/freightcenters_freight_setup/mysql4-install-1.0.0.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/* delete tables from database if exists */
|
4 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
5 |
+
|
6 |
+
|
7 |
+
$carriers_table = "Drop table if exists `brst_freight_shipping`";
|
8 |
+
$connection->query($carriers_table);
|
9 |
+
|
10 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
11 |
+
$installer = $this;
|
12 |
+
$installer->startSetup();
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Create table 'brst_freight_shipping'
|
16 |
+
*/
|
17 |
+
$table = $installer->getConnection()
|
18 |
+
// The following call to getTable('foo_bar/baz') will lookup the resource for foo_bar (foo_bar_mysql4), and look
|
19 |
+
// for a corresponding entity called baz. The table name in the XML is foo_bar_baz, so ths is what is created.
|
20 |
+
->newTable($installer->getTable('brst_freight_shipping'))
|
21 |
+
->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
22 |
+
'identity' => true,
|
23 |
+
'unsigned' => true,
|
24 |
+
'nullable' => false,
|
25 |
+
'primary' => true,
|
26 |
+
), 'ID')
|
27 |
+
->addColumn('product_id', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
28 |
+
'nullable' => false,
|
29 |
+
), 'Product Id');
|
30 |
+
->addColumn('shipping_charge', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
31 |
+
'nullable' => false,
|
32 |
+
), 'Shipping Charge');
|
33 |
+
->addColumn('quote_id', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
34 |
+
'nullable' => false,
|
35 |
+
), 'Quote Id');
|
36 |
+
|
37 |
+
$installer->getConnection()->createTable($table);
|
38 |
+
|
39 |
+
?>
|
app/code/local/Freightcenter/Ship/Block/Adminhtml/System/Config/Cdisplay.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Freightcenter_Ship_Block_Adminhtml_System_Config_Cdisplay extends Mage_Adminhtml_Block_System_Config_Form_Field{
|
3 |
+
const CONFIG_PATH = 'carriers/freightcenter/carrier_display'; //put here the full path from the config to your element
|
4 |
+
protected $_values = null;
|
5 |
+
protected function _construct()
|
6 |
+
{
|
7 |
+
$this->setTemplate('freightcenter_ship/system/config/cdisplay.phtml');
|
8 |
+
return parent::_construct();
|
9 |
+
}
|
10 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
11 |
+
{
|
12 |
+
$this->setNamePrefix($element->getName())
|
13 |
+
->setHtmlId($element->getHtmlId());
|
14 |
+
return $this->_toHtml();
|
15 |
+
}
|
16 |
+
public function getValues(){
|
17 |
+
$values = array();
|
18 |
+
//get the available values (use the source model from your question)
|
19 |
+
for($i=1;$i<=100;$i++) {
|
20 |
+
$values[$i] = $i;
|
21 |
+
}
|
22 |
+
return $values;
|
23 |
+
}
|
24 |
+
public function getIsChecked(){
|
25 |
+
if (is_null($this->_values)){
|
26 |
+
$data = $this->getConfigData();
|
27 |
+
if (isset($data[self::CONFIG_PATH])){
|
28 |
+
$data = $data[self::CONFIG_PATH];
|
29 |
+
}
|
30 |
+
else{
|
31 |
+
$data = '';
|
32 |
+
}
|
33 |
+
$this->_values = $data;
|
34 |
+
}
|
35 |
+
return $this->_values;
|
36 |
+
}
|
37 |
+
}
|
app/code/local/Freightcenter/Ship/Block/Adminhtml/System/Config/Destloctype.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Freightcenter_Ship_Block_Adminhtml_System_Config_Destloctype extends Mage_Adminhtml_Block_System_Config_Form_Field{
|
3 |
+
const CONFIG_PATH = 'carriers/freightcenter/dest_loctype'; //put here the full path from the config to your element
|
4 |
+
protected $_values = null;
|
5 |
+
protected function _construct()
|
6 |
+
{
|
7 |
+
$this->setTemplate('freightcenter_ship/system/config/destloctype.phtml');
|
8 |
+
return parent::_construct();
|
9 |
+
}
|
10 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
11 |
+
{
|
12 |
+
$this->setNamePrefix($element->getName())
|
13 |
+
->setHtmlId($element->getHtmlId());
|
14 |
+
return $this->_toHtml();
|
15 |
+
}
|
16 |
+
public function getValues(){
|
17 |
+
$values = array();
|
18 |
+
//get the available values (use the source model from your question)
|
19 |
+
foreach (Mage::getSingleton('ship/loctypes')->toOptionArray() as $value){
|
20 |
+
$values[$value['value']] = $value['label'];
|
21 |
+
}
|
22 |
+
return $values;
|
23 |
+
}
|
24 |
+
public function getIsChecked($name){
|
25 |
+
return in_array($name, $this->getCheckedValues());
|
26 |
+
}
|
27 |
+
public function getCheckedValues(){
|
28 |
+
if (is_null($this->_values)){
|
29 |
+
$data = $this->getConfigData();
|
30 |
+
if (isset($data[self::CONFIG_PATH])){
|
31 |
+
$data = $data[self::CONFIG_PATH];
|
32 |
+
}
|
33 |
+
else{
|
34 |
+
$data = '';
|
35 |
+
}
|
36 |
+
$this->_values = explode(',', $data);
|
37 |
+
}
|
38 |
+
return $this->_values;
|
39 |
+
}
|
40 |
+
}
|
app/code/local/Freightcenter/Ship/Block/Adminhtml/System/Config/Positions.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Freightcenter_Ship_Block_Adminhtml_System_Config_Positions extends Mage_Adminhtml_Block_System_Config_Form_Field{
|
3 |
+
const CONFIG_PATH = 'carriers/freightcenter/positions'; //put here the full path from the config to your element
|
4 |
+
protected $_values = null;
|
5 |
+
protected function _construct()
|
6 |
+
{
|
7 |
+
$this->setTemplate('freightcenter_ship/system/config/positions.phtml');
|
8 |
+
return parent::_construct();
|
9 |
+
}
|
10 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
11 |
+
{
|
12 |
+
$this->setNamePrefix($element->getName())
|
13 |
+
->setHtmlId($element->getHtmlId());
|
14 |
+
return $this->_toHtml();
|
15 |
+
}
|
16 |
+
public function getValues(){
|
17 |
+
$values = array();
|
18 |
+
//get the available values (use the source model from your question)
|
19 |
+
foreach (Mage::getSingleton('ship/carriers')->toOptionArray() as $value){
|
20 |
+
$values[$value['value']] = $value['label'];
|
21 |
+
}
|
22 |
+
return $values;
|
23 |
+
}
|
24 |
+
public function getIsChecked($name){
|
25 |
+
return in_array($name, $this->getCheckedValues());
|
26 |
+
}
|
27 |
+
public function getCheckedValues(){
|
28 |
+
if (is_null($this->_values)){
|
29 |
+
$data = $this->getConfigData();
|
30 |
+
if (isset($data[self::CONFIG_PATH])){
|
31 |
+
$data = $data[self::CONFIG_PATH];
|
32 |
+
}
|
33 |
+
else{
|
34 |
+
$data = '';
|
35 |
+
}
|
36 |
+
$this->_values = explode(',', $data);
|
37 |
+
}
|
38 |
+
return $this->_values;
|
39 |
+
}
|
40 |
+
}
|
app/code/local/Freightcenter/Ship/Block/Ship.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Freightcenter_Ship_Block_Ship extends Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
|
5 |
+
}
|
app/code/local/Freightcenter/Ship/Helper/Data.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Freightcenter_Ship_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
app/code/local/Freightcenter/Ship/Model/Carrier/Flatrate.php
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
//require_once 'Mage/Shipping/Model/Carrier/Flatrate.php';
|
3 |
+
|
4 |
+
|
5 |
+
class Freightcenter_Ship_Model_Carrier_Flatrate
|
6 |
+
extends Mage_Shipping_Model_Carrier_Abstract
|
7 |
+
implements Mage_Shipping_Model_Carrier_Interface
|
8 |
+
{
|
9 |
+
die('here');
|
10 |
+
protected $_code = 'flatrate';
|
11 |
+
protected $_isFixed = true;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Enter description here...
|
15 |
+
*
|
16 |
+
* @param Mage_Shipping_Model_Rate_Request $data
|
17 |
+
* @return Mage_Shipping_Model_Rate_Result
|
18 |
+
*/
|
19 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
20 |
+
{
|
21 |
+
|
22 |
+
if (!$this->getConfigFlag('active')) {
|
23 |
+
return false;
|
24 |
+
}
|
25 |
+
|
26 |
+
$freeBoxes = 0;
|
27 |
+
if ($request->getAllItems()) {
|
28 |
+
foreach ($request->getAllItems() as $item) {
|
29 |
+
|
30 |
+
if ($item->getProduct()->isVirtual() || $item->getParentItem()) {
|
31 |
+
continue;
|
32 |
+
}
|
33 |
+
|
34 |
+
if ($item->getHasChildren() && $item->isShipSeparately()) {
|
35 |
+
foreach ($item->getChildren() as $child) {
|
36 |
+
if ($child->getFreeShipping() && !$child->getProduct()->isVirtual()) {
|
37 |
+
$freeBoxes += $item->getQty() * $child->getQty();
|
38 |
+
}
|
39 |
+
}
|
40 |
+
} elseif ($item->getFreeShipping()) {
|
41 |
+
$freeBoxes += $item->getQty();
|
42 |
+
}
|
43 |
+
}
|
44 |
+
}
|
45 |
+
$this->setFreeBoxes($freeBoxes);
|
46 |
+
|
47 |
+
$result = Mage::getModel('shipping/rate_result');
|
48 |
+
if ($this->getConfigData('type') == 'O') { // per order
|
49 |
+
$shippingPrice = $this->getConfigData('price');
|
50 |
+
} elseif ($this->getConfigData('type') == 'I') { // per item
|
51 |
+
$shippingPrice = ($request->getPackageQty() * $this->getConfigData('price')) - ($this->getFreeBoxes() * $this->getConfigData('price'));
|
52 |
+
|
53 |
+
/* subtract flat rate price from freight products */
|
54 |
+
$getcount = '';
|
55 |
+
foreach($request->getAllItems() as $_item) {
|
56 |
+
$getid = $_item->getProductId();
|
57 |
+
$qty = $_item->getQty();
|
58 |
+
$promodel = Mage::getModel('catalog/product')->load($getid);
|
59 |
+
//echo "<pre>";print_r($promodel);exit;
|
60 |
+
$isfreight = $promodel['ship_via_freight'];
|
61 |
+
if($isfreight == 1) {
|
62 |
+
$getcount += $qty;
|
63 |
+
}
|
64 |
+
}
|
65 |
+
$default_price = $this->getConfigData('price');
|
66 |
+
$minus = ($getcount*$default_price);
|
67 |
+
$shippingPrice = ($shippingPrice-$minus);
|
68 |
+
|
69 |
+
} else {
|
70 |
+
$shippingPrice = false;
|
71 |
+
}
|
72 |
+
|
73 |
+
$shippingPrice = $this->getFinalPriceWithHandlingFee($shippingPrice);
|
74 |
+
|
75 |
+
if ($shippingPrice !== false) {
|
76 |
+
$method = Mage::getModel('shipping/rate_result_method');
|
77 |
+
|
78 |
+
$method->setCarrier('flatrate');
|
79 |
+
$method->setCarrierTitle($this->getConfigData('title'));
|
80 |
+
|
81 |
+
$method->setMethod('flatrate');
|
82 |
+
$method->setMethodTitle($this->getConfigData('name'));
|
83 |
+
|
84 |
+
if ($request->getFreeShipping() === true || $request->getPackageQty() == $this->getFreeBoxes()) {
|
85 |
+
$shippingPrice = '0.00';
|
86 |
+
}
|
87 |
+
|
88 |
+
|
89 |
+
$method->setPrice($shippingPrice);
|
90 |
+
$method->setCost($shippingPrice);
|
91 |
+
|
92 |
+
$result->append($method);
|
93 |
+
}
|
94 |
+
|
95 |
+
return $result;
|
96 |
+
}
|
97 |
+
|
98 |
+
public function getAllowedMethods()
|
99 |
+
{
|
100 |
+
return array('flatrate'=>$this->getConfigData('name'));
|
101 |
+
}
|
102 |
+
|
103 |
+
}
|
app/code/local/Freightcenter/Ship/Model/Carrier/Freightcenter.php
ADDED
@@ -0,0 +1,213 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Freightcenter_Ship_Model_Carrier_Freightcenter extends Mage_Shipping_Model_Carrier_Abstract
|
3 |
+
implements Mage_Shipping_Model_Carrier_Interface {
|
4 |
+
protected $_code = 'freightcenter';
|
5 |
+
|
6 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
7 |
+
{
|
8 |
+
if (!Mage::getStoreConfig('carriers/'.$this->_code.'/active')) {
|
9 |
+
return false;
|
10 |
+
}
|
11 |
+
|
12 |
+
$price = $this->getConfigData('price'); // set a default shipping price maybe 0
|
13 |
+
$price = 0;
|
14 |
+
//$model = Mage::getSingleton('freightcenter_customware/collect');
|
15 |
+
/*
|
16 |
+
//Case1: Price Depends on Country,State and Pin Code
|
17 |
+
echo $destCountry = $request->getDestCountryId().': Dest Country<br/>';
|
18 |
+
echo $destRegion = $request->getDestRegionId().': Dest Region<br/>';
|
19 |
+
echo $destRegionCode = $request->getDestRegionCode().': Dest Region Code<br/>';
|
20 |
+
print_r($destStreet = $request->getDestStreet()); echo ': Dest Street<br/>';
|
21 |
+
echo $destCity = $request->getDestCity().': Dest City<br/>';
|
22 |
+
echo $destPostcode = $request->getDestPostcode().': Dest Postcode<br/>';
|
23 |
+
echo $country_id = $request->getCountryId().': Package Source Country ID<br/>';
|
24 |
+
echo $region_id = $request->getRegionId().': Package Source Region ID<br/>';
|
25 |
+
echo $city = $request->getCity().': Package Source City<br/>';
|
26 |
+
echo $postcode = $request->getPostcode().': Package Source Post Code<br/>';
|
27 |
+
|
28 |
+
//Case2: Price Depends on Total Order Value or Weight
|
29 |
+
echo $packageValue = $request->getPackageValue().': Dest Package Value<br/>';
|
30 |
+
echo $packageValueDiscout = $request->getPackageValueWithDiscount().': Dest Package Value After Discount<br/>';
|
31 |
+
echo $packageWeight = $request->getPackageWeight().': Package Weight<br/>';
|
32 |
+
echo $packageQty = $request->getPackageQty().': Package Quantity <br/>';
|
33 |
+
echo $packageCurrency = $request->getPackageCurrency().': Package Currency <br/>';
|
34 |
+
|
35 |
+
//Case3: Price Depends on order dimensions
|
36 |
+
echo $packageheight = $request->getPackageHeight() .': Package height <br/>';
|
37 |
+
echo $request->getPackageWeight().': Package Width <br/>';
|
38 |
+
echo $request->getPackageDepth().': Package Depth <br/>';
|
39 |
+
|
40 |
+
|
41 |
+
|
42 |
+
//Case4: Price based on product attribute
|
43 |
+
if ($request->getAllItems()) {
|
44 |
+
foreach ($request->getAllItems() as $item) {
|
45 |
+
if ($item->getProduct()->isVirtual() || $item->getParentItem()) {
|
46 |
+
continue;
|
47 |
+
}
|
48 |
+
|
49 |
+
if ($item->getHasChildren() && $item->isShipSeparately()) {
|
50 |
+
foreach ($item->getChildren() as $child) {
|
51 |
+
if ($child->getFreeShipping() && !$child->getProduct()->isVirtual()) {
|
52 |
+
$product_id = $child->getProductId();
|
53 |
+
$productObj = Mage::getModel('catalog/product')->load($product_id);
|
54 |
+
$ship_price = $productObj->getData('shipping_price'); //our shipping attribute code
|
55 |
+
$price += (float)$ship_price;
|
56 |
+
}
|
57 |
+
}
|
58 |
+
} else {
|
59 |
+
$product_id = $item->getProductId();
|
60 |
+
$productObj = Mage::getModel('catalog/product')->load($product_id);
|
61 |
+
$ship_price = $productObj->getData('shipping_price'); //our shipping attribute code
|
62 |
+
$price += (float)$ship_price;
|
63 |
+
}
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
//Case5: Shipping option based configurable product option
|
68 |
+
if ($request->getAllItems()) {
|
69 |
+
foreach ($request->getAllItems() as $item) {
|
70 |
+
if ($item->getProduct()->isVirtual() || $item->getParentItem()) {
|
71 |
+
continue;
|
72 |
+
}
|
73 |
+
if ($item->getHasChildren() && $item->isShipSeparately()) {
|
74 |
+
foreach ($item->getChildren() as $child) {
|
75 |
+
if ($child->getFreeShipping() && !$child->getProduct()->isVirtual()) {
|
76 |
+
$product_id = $child->getProductId();
|
77 |
+
$value = $item->getOptionByCode('info_buyRequest')->getValue();
|
78 |
+
$params = unserialize($value);
|
79 |
+
$attributeObj = Mage::getModel('eav/config')->getAttribute(Mage_Catalog_Model_Product::ENTITY,'shirt_size'); // our configurable attribute
|
80 |
+
$attribute_id = $attributeObj->getAttributeId();
|
81 |
+
$attribute_selected = $params['super_attribute'][$attribute_id];
|
82 |
+
|
83 |
+
$label = '';
|
84 |
+
foreach($attributeObj->getSource()->getAllOptions(false) as $option){
|
85 |
+
if($option['value'] == $attribute_selected){
|
86 |
+
$label = $option['label'];
|
87 |
+
}
|
88 |
+
}
|
89 |
+
if($label = 'Small'){
|
90 |
+
$price += 15;
|
91 |
+
} else if($label = 'Medium'){
|
92 |
+
$price += 20;
|
93 |
+
} else if($label = 'Large'){
|
94 |
+
$price += 22;
|
95 |
+
}
|
96 |
+
}
|
97 |
+
}
|
98 |
+
} else {
|
99 |
+
$product_id = $item->getProductId();
|
100 |
+
$value = $item->getOptionByCode('info_buyRequest')->getValue();
|
101 |
+
$params = unserialize($value);
|
102 |
+
$attributeObj = Mage::getModel('eav/config')->getAttribute(Mage_Catalog_Model_Product::ENTITY,'shirt_size'); // our configurable attribute
|
103 |
+
$attribute_id = $attributeObj->getAttributeId();
|
104 |
+
$attribute_selected = $params['super_attribute'][$attribute_id];
|
105 |
+
|
106 |
+
$label = '';
|
107 |
+
foreach($attributeObj->getSource()->getAllOptions(false) as $option){
|
108 |
+
if($option['value'] == $attribute_selected){
|
109 |
+
$label = $option['label'];
|
110 |
+
}
|
111 |
+
}
|
112 |
+
if($label = 'Small'){
|
113 |
+
$price += 15;
|
114 |
+
} else if($label = 'Medium'){
|
115 |
+
$price += 20;
|
116 |
+
} else if($label = 'Large'){
|
117 |
+
$price += 22;
|
118 |
+
}
|
119 |
+
}
|
120 |
+
}
|
121 |
+
}
|
122 |
+
|
123 |
+
|
124 |
+
//Case6: Price based on custom options
|
125 |
+
if ($request->getAllItems()) {
|
126 |
+
foreach ($request->getAllItems() as $item) {
|
127 |
+
if ($item->getProduct()->isVirtual() || $item->getParentItem()) {
|
128 |
+
continue;
|
129 |
+
}
|
130 |
+
if ($item->getHasChildren() && $item->isShipSeparately()) {
|
131 |
+
foreach ($item->getChildren() as $child) {
|
132 |
+
if ($child->getFreeShipping() && !$child->getProduct()->isVirtual()) {
|
133 |
+
$product_id = $child->getProductId();
|
134 |
+
$value = $item->getOptionByCode('info_buyRequest')->getValue();
|
135 |
+
$params = unserialize($value);
|
136 |
+
$options_select = $params['options'];
|
137 |
+
|
138 |
+
$product = Mage::getModel('catalog/product')->load($product_id);
|
139 |
+
$options = $product->getOptions();
|
140 |
+
foreach ($options as $option) {
|
141 |
+
if ($option->getGroupByType() == Mage_Catalog_Model_Product_Option::OPTION_GROUP_SELECT) {
|
142 |
+
$option_id = $option->getId();
|
143 |
+
foreach ($option->getValues() as $value) {
|
144 |
+
if($value->getId() == $options_select[$option_id]){
|
145 |
+
if($value->getTitle() == 'Express'){
|
146 |
+
$price += 50;
|
147 |
+
}else if($value->getTitle() == 'Normal'){
|
148 |
+
$price += 10;
|
149 |
+
}
|
150 |
+
}
|
151 |
+
|
152 |
+
}
|
153 |
+
}
|
154 |
+
}
|
155 |
+
}
|
156 |
+
}
|
157 |
+
} else {
|
158 |
+
$product_id = $item->getProductId();
|
159 |
+
$value = $item->getOptionByCode('info_buyRequest')->getValue();
|
160 |
+
$params = unserialize($value);
|
161 |
+
$options_select = $params['options'];
|
162 |
+
|
163 |
+
$product = Mage::getModel('catalog/product')->load($product_id);
|
164 |
+
$options = $product->getOptions();
|
165 |
+
foreach ($options as $option) {
|
166 |
+
if ($option->getGroupByType() == Mage_Catalog_Model_Product_Option::OPTION_GROUP_SELECT) {
|
167 |
+
$option_id = $option->getId();
|
168 |
+
foreach ($option->getValues() as $value) {
|
169 |
+
if($value->getId() == $options_select[$option_id]){
|
170 |
+
if($value->getTitle() == 'Express'){
|
171 |
+
$price += 50;
|
172 |
+
}else if($value->getTitle() == 'Normal'){
|
173 |
+
$price += 10;
|
174 |
+
}
|
175 |
+
}
|
176 |
+
|
177 |
+
}
|
178 |
+
}
|
179 |
+
}
|
180 |
+
}
|
181 |
+
}
|
182 |
+
}
|
183 |
+
*/
|
184 |
+
|
185 |
+
|
186 |
+
$handling = Mage::getStoreConfig('carriers/'.$this->_code.'/handling');
|
187 |
+
$result = Mage::getModel('shipping/rate_result');
|
188 |
+
$show = true;
|
189 |
+
if($show){
|
190 |
+
|
191 |
+
$method = Mage::getModel('shipping/rate_result_method');
|
192 |
+
$method->setCarrier($this->_code);
|
193 |
+
$method->setMethod($this->_code);
|
194 |
+
$method->setCarrierTitle($this->getConfigData('title'));
|
195 |
+
$method->setMethodTitle($this->getConfigData('name'));
|
196 |
+
$method->setPrice($price);
|
197 |
+
$method->setCost($price);
|
198 |
+
$result->append($method);
|
199 |
+
|
200 |
+
}else{
|
201 |
+
$error = Mage::getModel('shipping/rate_result_error');
|
202 |
+
$error->setCarrier($this->_code);
|
203 |
+
$error->setCarrierTitle($this->getConfigData('name'));
|
204 |
+
$error->setErrorMessage($this->getConfigData('specificerrmsg'));
|
205 |
+
$result->append($error);
|
206 |
+
}
|
207 |
+
return $result;
|
208 |
+
}
|
209 |
+
public function getAllowedMethods()
|
210 |
+
{
|
211 |
+
return array('freightcenter'=>$this->getConfigData('name'));
|
212 |
+
}
|
213 |
+
}
|
app/code/local/Freightcenter/Ship/Model/CarrierDisplay.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Freightcenter_Ship_Model_CarrierDisplay
|
3 |
+
{
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Options getter
|
7 |
+
*
|
8 |
+
* @return array
|
9 |
+
*/
|
10 |
+
public function toOptionArray()
|
11 |
+
{
|
12 |
+
for($i=1;$i<=100;$i++) {
|
13 |
+
$array[] = array('value' => $i, 'label'=>Mage::helper('adminhtml')->__($i));
|
14 |
+
}
|
15 |
+
return $array;
|
16 |
+
}
|
17 |
+
|
18 |
+
}
|
app/code/local/Freightcenter/Ship/Model/Carriers.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Freightcenter_Ship_Model_Carriers
|
3 |
+
{
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Options getter
|
7 |
+
*
|
8 |
+
* @return array
|
9 |
+
*/
|
10 |
+
public function toOptionArray()
|
11 |
+
{
|
12 |
+
$current_freight_user = Mage::getStoreConfig('carriers/freightcenter/freightuser');
|
13 |
+
|
14 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
15 |
+
$carrier_query = $connection->query("select * from brst_freight_carriers where username = '$current_freight_user'");
|
16 |
+
$getcarrier = $carrier_query->fetchAll();
|
17 |
+
//echo "<pre>";print_r($getcarrier);exit;
|
18 |
+
$all_carriers = array();
|
19 |
+
if($getcarrier == NULL) {
|
20 |
+
$all_carriers = '';
|
21 |
+
} else {
|
22 |
+
foreach($getcarrier as $carrier) {
|
23 |
+
$carrierid = $carrier['id'];
|
24 |
+
$carriercode = $carrier['carrier_code'];
|
25 |
+
$carriername = $carrier['carrier_name'];
|
26 |
+
$all_carriers[] = array('value' => $carriercode, 'label'=>Mage::helper('adminhtml')->__($carriername));
|
27 |
+
}
|
28 |
+
}
|
29 |
+
|
30 |
+
return $all_carriers;
|
31 |
+
}
|
32 |
+
}
|
app/code/local/Freightcenter/Ship/Model/Carriers_23rdMay.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Freightcenter_Ship_Model_Carriers
|
3 |
+
{
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Options getter
|
7 |
+
*
|
8 |
+
* @return array
|
9 |
+
*/
|
10 |
+
public function toOptionArray()
|
11 |
+
{
|
12 |
+
$current_freight_user = Mage::getStoreConfig('carriers/freightcenter/freightuser');
|
13 |
+
|
14 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
15 |
+
$carrier_query = $connection->query("select * from brst_freight_carriers where username = '$current_freight_user'");
|
16 |
+
$getcarrier = $carrier_query->fetchAll();
|
17 |
+
//echo "<pre>";print_r($getcarrier);exit;
|
18 |
+
$all_carriers = array();
|
19 |
+
if($getcarrier == NULL) {
|
20 |
+
$all_carriers = '';
|
21 |
+
} else {
|
22 |
+
foreach($getcarrier as $carrier) {
|
23 |
+
$carrierid = $carrier['id'];
|
24 |
+
$carriername = $carrier['carrier_name'];
|
25 |
+
$all_carriers[] = array('value' => $carrierid, 'label'=>Mage::helper('adminhtml')->__($carriername));
|
26 |
+
}
|
27 |
+
}
|
28 |
+
|
29 |
+
return $all_carriers;
|
30 |
+
}
|
31 |
+
}
|
app/code/local/Freightcenter/Ship/Model/Discount.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Freightcenter_Ship_Model_Discount
|
3 |
+
{
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Options getter
|
7 |
+
*
|
8 |
+
* @return array
|
9 |
+
*/
|
10 |
+
public function toOptionArray()
|
11 |
+
{
|
12 |
+
return array(
|
13 |
+
array('value' => '1', 'label'=>Mage::helper('adminhtml')->__('Enable')),
|
14 |
+
array('value' => '0', 'label'=>Mage::helper('adminhtml')->__('Disable')),
|
15 |
+
);
|
16 |
+
}
|
17 |
+
|
18 |
+
}
|
app/code/local/Freightcenter/Ship/Model/Flatrate.php__
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
//require_once 'Mage/Shipping/Model/Carrier/Flatrate.php';
|
3 |
+
class Freightcenter_Ship_Model_Flatrate
|
4 |
+
extends Mage_Shipping_Model_Carrier_Abstract
|
5 |
+
implements Mage_Shipping_Model_Carrier_Interface
|
6 |
+
{
|
7 |
+
die('this');
|
8 |
+
protected $_code = 'flatrate';
|
9 |
+
protected $_isFixed = true;
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Enter description here...
|
13 |
+
*
|
14 |
+
* @param Mage_Shipping_Model_Rate_Request $data
|
15 |
+
* @return Mage_Shipping_Model_Rate_Result
|
16 |
+
*/
|
17 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
18 |
+
{
|
19 |
+
|
20 |
+
if (!$this->getConfigFlag('active')) {
|
21 |
+
return false;
|
22 |
+
}
|
23 |
+
|
24 |
+
$freeBoxes = 0;
|
25 |
+
if ($request->getAllItems()) {
|
26 |
+
foreach ($request->getAllItems() as $item) {
|
27 |
+
|
28 |
+
if ($item->getProduct()->isVirtual() || $item->getParentItem()) {
|
29 |
+
continue;
|
30 |
+
}
|
31 |
+
|
32 |
+
if ($item->getHasChildren() && $item->isShipSeparately()) {
|
33 |
+
foreach ($item->getChildren() as $child) {
|
34 |
+
if ($child->getFreeShipping() && !$child->getProduct()->isVirtual()) {
|
35 |
+
$freeBoxes += $item->getQty() * $child->getQty();
|
36 |
+
}
|
37 |
+
}
|
38 |
+
} elseif ($item->getFreeShipping()) {
|
39 |
+
$freeBoxes += $item->getQty();
|
40 |
+
}
|
41 |
+
}
|
42 |
+
}
|
43 |
+
$this->setFreeBoxes($freeBoxes);
|
44 |
+
|
45 |
+
$result = Mage::getModel('shipping/rate_result');
|
46 |
+
if ($this->getConfigData('type') == 'O') { // per order
|
47 |
+
$shippingPrice = $this->getConfigData('price');
|
48 |
+
} elseif ($this->getConfigData('type') == 'I') { // per item
|
49 |
+
$shippingPrice = ($request->getPackageQty() * $this->getConfigData('price')) - ($this->getFreeBoxes() * $this->getConfigData('price'));
|
50 |
+
|
51 |
+
/* subtract flat rate price from freight products */
|
52 |
+
$getcount = '';
|
53 |
+
foreach($request->getAllItems() as $_item) {
|
54 |
+
$getid = $_item->getProductId();
|
55 |
+
$qty = $_item->getQty();
|
56 |
+
$promodel = Mage::getModel('catalog/product')->load($getid);
|
57 |
+
//echo "<pre>";print_r($promodel);exit;
|
58 |
+
$isfreight = $promodel['ship_via_freight'];
|
59 |
+
if($isfreight == 1) {
|
60 |
+
$getcount += $qty;
|
61 |
+
}
|
62 |
+
}
|
63 |
+
$default_price = $this->getConfigData('price');
|
64 |
+
$minus = ($getcount*$default_price);
|
65 |
+
$shippingPrice = ($shippingPrice-$minus);
|
66 |
+
|
67 |
+
} else {
|
68 |
+
$shippingPrice = false;
|
69 |
+
}
|
70 |
+
|
71 |
+
$shippingPrice = $this->getFinalPriceWithHandlingFee($shippingPrice);
|
72 |
+
|
73 |
+
if ($shippingPrice !== false) {
|
74 |
+
$method = Mage::getModel('shipping/rate_result_method');
|
75 |
+
|
76 |
+
$method->setCarrier('flatrate');
|
77 |
+
$method->setCarrierTitle($this->getConfigData('title'));
|
78 |
+
|
79 |
+
$method->setMethod('flatrate');
|
80 |
+
$method->setMethodTitle($this->getConfigData('name'));
|
81 |
+
|
82 |
+
if ($request->getFreeShipping() === true || $request->getPackageQty() == $this->getFreeBoxes()) {
|
83 |
+
$shippingPrice = '0.00';
|
84 |
+
}
|
85 |
+
|
86 |
+
|
87 |
+
$method->setPrice($shippingPrice);
|
88 |
+
$method->setCost($shippingPrice);
|
89 |
+
|
90 |
+
$result->append($method);
|
91 |
+
}
|
92 |
+
|
93 |
+
return $result;
|
94 |
+
}
|
95 |
+
|
96 |
+
public function getAllowedMethods()
|
97 |
+
{
|
98 |
+
return array('flatrate'=>$this->getConfigData('name'));
|
99 |
+
}
|
100 |
+
|
101 |
+
}
|
app/code/local/Freightcenter/Ship/Model/Loctypes.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Freightcenter_Ship_Model_Loctypes
|
3 |
+
{
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Options getter
|
7 |
+
*
|
8 |
+
* @return array
|
9 |
+
*/
|
10 |
+
public function toOptionArray()
|
11 |
+
{
|
12 |
+
return array(
|
13 |
+
array('value' => 'Residential', 'label'=>Mage::helper('adminhtml')->__('Residential')),
|
14 |
+
array('value' => 'Business With Dock or Forklift', 'label'=>Mage::helper('adminhtml')->__('Business With Dock or Forklift')),
|
15 |
+
array('value' => 'Business Without Dock or Forklift', 'label'=>Mage::helper('adminhtml')->__('Business Without Dock or Forklift')),
|
16 |
+
array('value' => 'Construction Site', 'label'=>Mage::helper('adminhtml')->__('Construction Site')),
|
17 |
+
array('value' => 'Convention Center or Tradeshow', 'label'=>Mage::helper('adminhtml')->__('Convention Center or Tradeshow')),
|
18 |
+
array('value' => 'Terminal', 'label'=>Mage::helper('adminhtml')->__('Terminal')),
|
19 |
+
);
|
20 |
+
}
|
21 |
+
|
22 |
+
}
|
app/code/local/Freightcenter/Ship/Model/Mark.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Freightcenter_Ship_Model_Mark
|
3 |
+
{
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Options getter
|
7 |
+
*
|
8 |
+
* @return array
|
9 |
+
*/
|
10 |
+
public function toOptionArray()
|
11 |
+
{
|
12 |
+
return array(
|
13 |
+
array('value' => 'none', 'label'=>Mage::helper('adminhtml')->__('None')),
|
14 |
+
array('value' => 'markup', 'label'=>Mage::helper('adminhtml')->__('Markup')),
|
15 |
+
array('value' => 'discount', 'label'=>Mage::helper('adminhtml')->__('Discount')),
|
16 |
+
);
|
17 |
+
}
|
18 |
+
|
19 |
+
}
|
app/code/local/Freightcenter/Ship/Model/Mode.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Freightcenter_Ship_Model_Mode
|
3 |
+
{
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Options getter
|
7 |
+
*
|
8 |
+
* @return array
|
9 |
+
*/
|
10 |
+
public function toOptionArray()
|
11 |
+
{
|
12 |
+
return array(
|
13 |
+
array('value' => '1', 'label'=>Mage::helper('adminhtml')->__('View as individual warehouse shipments')),
|
14 |
+
array('value' => '0', 'label'=>Mage::helper('adminhtml')->__('View as Single Freight Charge')),
|
15 |
+
);
|
16 |
+
}
|
17 |
+
|
18 |
+
}
|
app/code/local/Freightcenter/Ship/Model/Sand.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Freightcenter_Ship_Model_Sand
|
3 |
+
{
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Options getter
|
7 |
+
*
|
8 |
+
* @return array
|
9 |
+
*/
|
10 |
+
public function toOptionArray()
|
11 |
+
{
|
12 |
+
return array(
|
13 |
+
array('value' => '1', 'label'=>Mage::helper('adminhtml')->__('Sandbox')),
|
14 |
+
array('value' => '0', 'label'=>Mage::helper('adminhtml')->__('Live')),
|
15 |
+
);
|
16 |
+
}
|
17 |
+
|
18 |
+
}
|
app/code/local/Freightcenter/Ship/Model/Types.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Freightcenter_Ship_Model_Types
|
3 |
+
{
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Options getter
|
7 |
+
*
|
8 |
+
* @return array
|
9 |
+
*/
|
10 |
+
public function toOptionArray()
|
11 |
+
{
|
12 |
+
return array(
|
13 |
+
array('value' => 'flat', 'label'=>Mage::helper('adminhtml')->__('Flat')),
|
14 |
+
array('value' => 'percent', 'label'=>Mage::helper('adminhtml')->__('Percentage')),
|
15 |
+
);
|
16 |
+
}
|
17 |
+
|
18 |
+
}
|
app/code/local/Freightcenter/Ship/controllers/CartController.php
ADDED
@@ -0,0 +1,561 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once 'Mage/Checkout/controllers/CartController.php';
|
3 |
+
class Freightcenter_Ship_CartController extends Mage_Checkout_CartController
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Action list where need check enabled cookie
|
7 |
+
*
|
8 |
+
* @var array
|
9 |
+
*/
|
10 |
+
|
11 |
+
protected $_cookieCheckActions = array('add');
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Retrieve shopping cart model object
|
15 |
+
*
|
16 |
+
* @return Mage_Checkout_Model_Cart
|
17 |
+
*/
|
18 |
+
protected function _getCart()
|
19 |
+
{
|
20 |
+
return Mage::getSingleton('checkout/cart');
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Get checkout session model instance
|
25 |
+
*
|
26 |
+
* @return Mage_Checkout_Model_Session
|
27 |
+
*/
|
28 |
+
protected function _getSession()
|
29 |
+
{
|
30 |
+
return Mage::getSingleton('checkout/session');
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Get current active quote instance
|
35 |
+
*
|
36 |
+
* @return Mage_Sales_Model_Quote
|
37 |
+
*/
|
38 |
+
protected function _getQuote()
|
39 |
+
{
|
40 |
+
return $this->_getCart()->getQuote();
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Set back redirect url to response
|
45 |
+
*
|
46 |
+
* @return Mage_Checkout_CartController
|
47 |
+
* @throws Mage_Exception
|
48 |
+
*/
|
49 |
+
protected function _goBack()
|
50 |
+
{
|
51 |
+
$returnUrl = $this->getRequest()->getParam('return_url');
|
52 |
+
if ($returnUrl) {
|
53 |
+
|
54 |
+
if (!$this->_isUrlInternal($returnUrl)) {
|
55 |
+
throw new Mage_Exception('External urls redirect to "' . $returnUrl . '" denied!');
|
56 |
+
}
|
57 |
+
|
58 |
+
$this->_getSession()->getMessages(true);
|
59 |
+
$this->getResponse()->setRedirect($returnUrl);
|
60 |
+
} elseif (!Mage::getStoreConfig('checkout/cart/redirect_to_cart')
|
61 |
+
&& !$this->getRequest()->getParam('in_cart')
|
62 |
+
&& $backUrl = $this->_getRefererUrl()
|
63 |
+
) {
|
64 |
+
$this->getResponse()->setRedirect($backUrl);
|
65 |
+
} else {
|
66 |
+
if (($this->getRequest()->getActionName() == 'add') && !$this->getRequest()->getParam('in_cart')) {
|
67 |
+
$this->_getSession()->setContinueShoppingUrl($this->_getRefererUrl());
|
68 |
+
}
|
69 |
+
$this->_redirect('checkout/cart');
|
70 |
+
}
|
71 |
+
return $this;
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Initialize product instance from request data
|
76 |
+
*
|
77 |
+
* @return Mage_Catalog_Model_Product || false
|
78 |
+
*/
|
79 |
+
protected function _initProduct()
|
80 |
+
{
|
81 |
+
$productId = (int) $this->getRequest()->getParam('product');
|
82 |
+
if ($productId) {
|
83 |
+
$product = Mage::getModel('catalog/product')
|
84 |
+
->setStoreId(Mage::app()->getStore()->getId())
|
85 |
+
->load($productId);
|
86 |
+
if ($product->getId()) {
|
87 |
+
return $product;
|
88 |
+
}
|
89 |
+
}
|
90 |
+
return false;
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Shopping cart display action
|
95 |
+
*/
|
96 |
+
public function indexAction()
|
97 |
+
{
|
98 |
+
$cart = $this->_getCart();
|
99 |
+
if ($cart->getQuote()->getItemsCount()) {
|
100 |
+
$cart->init();
|
101 |
+
$cart->save();
|
102 |
+
|
103 |
+
if (!$this->_getQuote()->validateMinimumAmount()) {
|
104 |
+
$minimumAmount = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())
|
105 |
+
->toCurrency(Mage::getStoreConfig('sales/minimum_order/amount'));
|
106 |
+
|
107 |
+
$warning = Mage::getStoreConfig('sales/minimum_order/description')
|
108 |
+
? Mage::getStoreConfig('sales/minimum_order/description')
|
109 |
+
: Mage::helper('checkout')->__('Minimum order amount is %s', $minimumAmount);
|
110 |
+
|
111 |
+
$cart->getCheckoutSession()->addNotice($warning);
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
+
// Compose array of messages to add
|
116 |
+
$messages = array();
|
117 |
+
foreach ($cart->getQuote()->getMessages() as $message) {
|
118 |
+
if ($message) {
|
119 |
+
// Escape HTML entities in quote message to prevent XSS
|
120 |
+
$message->setCode(Mage::helper('core')->escapeHtml($message->getCode()));
|
121 |
+
$messages[] = $message;
|
122 |
+
}
|
123 |
+
}
|
124 |
+
$cart->getCheckoutSession()->addUniqueMessages($messages);
|
125 |
+
|
126 |
+
/**
|
127 |
+
* if customer enteres shopping cart we should mark quote
|
128 |
+
* as modified bc he can has checkout page in another window.
|
129 |
+
*/
|
130 |
+
$this->_getSession()->setCartWasUpdated(true);
|
131 |
+
|
132 |
+
Varien_Profiler::start(__METHOD__ . 'cart_display');
|
133 |
+
$this
|
134 |
+
->loadLayout()
|
135 |
+
->_initLayoutMessages('checkout/session')
|
136 |
+
->_initLayoutMessages('catalog/session')
|
137 |
+
->getLayout()->getBlock('head')->setTitle($this->__('Shopping Cart'));
|
138 |
+
$this->renderLayout();
|
139 |
+
Varien_Profiler::stop(__METHOD__ . 'cart_display');
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Add product to shopping cart action
|
144 |
+
*
|
145 |
+
* @return Mage_Core_Controller_Varien_Action
|
146 |
+
* @throws Exception
|
147 |
+
*/
|
148 |
+
public function addAction()
|
149 |
+
{
|
150 |
+
if (!$this->_validateFormKey()) {
|
151 |
+
$this->_goBack();
|
152 |
+
return;
|
153 |
+
}
|
154 |
+
$cart = $this->_getCart();
|
155 |
+
$params = $this->getRequest()->getParams();
|
156 |
+
try {
|
157 |
+
if (isset($params['qty'])) {
|
158 |
+
$filter = new Zend_Filter_LocalizedToNormalized(
|
159 |
+
array('locale' => Mage::app()->getLocale()->getLocaleCode())
|
160 |
+
);
|
161 |
+
$params['qty'] = $filter->filter($params['qty']);
|
162 |
+
}
|
163 |
+
|
164 |
+
$product = $this->_initProduct();
|
165 |
+
$related = $this->getRequest()->getParam('related_product');
|
166 |
+
|
167 |
+
/**
|
168 |
+
* Check product availability
|
169 |
+
*/
|
170 |
+
if (!$product) {
|
171 |
+
$this->_goBack();
|
172 |
+
return;
|
173 |
+
}
|
174 |
+
|
175 |
+
$cart->addProduct($product, $params);
|
176 |
+
if (!empty($related)) {
|
177 |
+
$cart->addProductsByIds(explode(',', $related));
|
178 |
+
}
|
179 |
+
|
180 |
+
$cart->save();
|
181 |
+
|
182 |
+
$this->_getSession()->setCartWasUpdated(true);
|
183 |
+
|
184 |
+
/**
|
185 |
+
* @todo remove wishlist observer processAddToCart
|
186 |
+
*/
|
187 |
+
Mage::dispatchEvent('checkout_cart_add_product_complete',
|
188 |
+
array('product' => $product, 'request' => $this->getRequest(), 'response' => $this->getResponse())
|
189 |
+
);
|
190 |
+
|
191 |
+
if (!$this->_getSession()->getNoCartRedirect(true)) {
|
192 |
+
if (!$cart->getQuote()->getHasError()) {
|
193 |
+
$message = $this->__('%s was added to your shopping cart.', Mage::helper('core')->escapeHtml($product->getName()));
|
194 |
+
$this->_getSession()->addSuccess($message);
|
195 |
+
}
|
196 |
+
$this->_goBack();
|
197 |
+
}
|
198 |
+
} catch (Mage_Core_Exception $e) {
|
199 |
+
if ($this->_getSession()->getUseNotice(true)) {
|
200 |
+
$this->_getSession()->addNotice(Mage::helper('core')->escapeHtml($e->getMessage()));
|
201 |
+
} else {
|
202 |
+
$messages = array_unique(explode("\n", $e->getMessage()));
|
203 |
+
foreach ($messages as $message) {
|
204 |
+
$this->_getSession()->addError(Mage::helper('core')->escapeHtml($message));
|
205 |
+
}
|
206 |
+
}
|
207 |
+
|
208 |
+
$url = $this->_getSession()->getRedirectUrl(true);
|
209 |
+
if ($url) {
|
210 |
+
$this->getResponse()->setRedirect($url);
|
211 |
+
} else {
|
212 |
+
$this->_redirectReferer(Mage::helper('checkout/cart')->getCartUrl());
|
213 |
+
}
|
214 |
+
} catch (Exception $e) {
|
215 |
+
$this->_getSession()->addException($e, $this->__('Cannot add the item to shopping cart.'));
|
216 |
+
Mage::logException($e);
|
217 |
+
$this->_goBack();
|
218 |
+
}
|
219 |
+
}
|
220 |
+
|
221 |
+
/**
|
222 |
+
* Add products in group to shopping cart action
|
223 |
+
*/
|
224 |
+
public function addgroupAction()
|
225 |
+
{
|
226 |
+
$orderItemIds = $this->getRequest()->getParam('order_items', array());
|
227 |
+
|
228 |
+
if (!is_array($orderItemIds) || !$this->_validateFormKey()) {
|
229 |
+
$this->_goBack();
|
230 |
+
return;
|
231 |
+
}
|
232 |
+
|
233 |
+
$itemsCollection = Mage::getModel('sales/order_item')
|
234 |
+
->getCollection()
|
235 |
+
->addIdFilter($orderItemIds)
|
236 |
+
->load();
|
237 |
+
/* @var $itemsCollection Mage_Sales_Model_Mysql4_Order_Item_Collection */
|
238 |
+
$cart = $this->_getCart();
|
239 |
+
foreach ($itemsCollection as $item) {
|
240 |
+
try {
|
241 |
+
$cart->addOrderItem($item, 1);
|
242 |
+
} catch (Mage_Core_Exception $e) {
|
243 |
+
if ($this->_getSession()->getUseNotice(true)) {
|
244 |
+
$this->_getSession()->addNotice($e->getMessage());
|
245 |
+
} else {
|
246 |
+
$this->_getSession()->addError($e->getMessage());
|
247 |
+
}
|
248 |
+
} catch (Exception $e) {
|
249 |
+
$this->_getSession()->addException($e, $this->__('Cannot add the item to shopping cart.'));
|
250 |
+
Mage::logException($e);
|
251 |
+
$this->_goBack();
|
252 |
+
}
|
253 |
+
}
|
254 |
+
$cart->save();
|
255 |
+
$this->_getSession()->setCartWasUpdated(true);
|
256 |
+
$this->_goBack();
|
257 |
+
}
|
258 |
+
|
259 |
+
/**
|
260 |
+
* Action to reconfigure cart item
|
261 |
+
*/
|
262 |
+
public function configureAction()
|
263 |
+
{
|
264 |
+
// Extract item and product to configure
|
265 |
+
$id = (int) $this->getRequest()->getParam('id');
|
266 |
+
$quoteItem = null;
|
267 |
+
$cart = $this->_getCart();
|
268 |
+
if ($id) {
|
269 |
+
$quoteItem = $cart->getQuote()->getItemById($id);
|
270 |
+
}
|
271 |
+
|
272 |
+
if (!$quoteItem) {
|
273 |
+
$this->_getSession()->addError($this->__('Quote item is not found.'));
|
274 |
+
$this->_redirect('checkout/cart');
|
275 |
+
return;
|
276 |
+
}
|
277 |
+
|
278 |
+
try {
|
279 |
+
$params = new Varien_Object();
|
280 |
+
$params->setCategoryId(false);
|
281 |
+
$params->setConfigureMode(true);
|
282 |
+
$params->setBuyRequest($quoteItem->getBuyRequest());
|
283 |
+
|
284 |
+
Mage::helper('catalog/product_view')->prepareAndRender($quoteItem->getProduct()->getId(), $this, $params);
|
285 |
+
} catch (Exception $e) {
|
286 |
+
$this->_getSession()->addError($this->__('Cannot configure product.'));
|
287 |
+
Mage::logException($e);
|
288 |
+
$this->_goBack();
|
289 |
+
return;
|
290 |
+
}
|
291 |
+
}
|
292 |
+
|
293 |
+
/**
|
294 |
+
* Update product configuration for a cart item
|
295 |
+
*/
|
296 |
+
public function updateItemOptionsAction()
|
297 |
+
{
|
298 |
+
$cart = $this->_getCart();
|
299 |
+
$id = (int) $this->getRequest()->getParam('id');
|
300 |
+
$params = $this->getRequest()->getParams();
|
301 |
+
|
302 |
+
if (!isset($params['options'])) {
|
303 |
+
$params['options'] = array();
|
304 |
+
}
|
305 |
+
try {
|
306 |
+
if (isset($params['qty'])) {
|
307 |
+
$filter = new Zend_Filter_LocalizedToNormalized(
|
308 |
+
array('locale' => Mage::app()->getLocale()->getLocaleCode())
|
309 |
+
);
|
310 |
+
$params['qty'] = $filter->filter($params['qty']);
|
311 |
+
}
|
312 |
+
|
313 |
+
$quoteItem = $cart->getQuote()->getItemById($id);
|
314 |
+
if (!$quoteItem) {
|
315 |
+
Mage::throwException($this->__('Quote item is not found.'));
|
316 |
+
}
|
317 |
+
|
318 |
+
$item = $cart->updateItem($id, new Varien_Object($params));
|
319 |
+
if (is_string($item)) {
|
320 |
+
Mage::throwException($item);
|
321 |
+
}
|
322 |
+
if ($item->getHasError()) {
|
323 |
+
Mage::throwException($item->getMessage());
|
324 |
+
}
|
325 |
+
|
326 |
+
$related = $this->getRequest()->getParam('related_product');
|
327 |
+
if (!empty($related)) {
|
328 |
+
$cart->addProductsByIds(explode(',', $related));
|
329 |
+
}
|
330 |
+
|
331 |
+
$cart->save();
|
332 |
+
|
333 |
+
$this->_getSession()->setCartWasUpdated(true);
|
334 |
+
|
335 |
+
Mage::dispatchEvent('checkout_cart_update_item_complete',
|
336 |
+
array('item' => $item, 'request' => $this->getRequest(), 'response' => $this->getResponse())
|
337 |
+
);
|
338 |
+
if (!$this->_getSession()->getNoCartRedirect(true)) {
|
339 |
+
if (!$cart->getQuote()->getHasError()) {
|
340 |
+
$message = $this->__('%s was updated in your shopping cart.', Mage::helper('core')->escapeHtml($item->getProduct()->getName()));
|
341 |
+
$this->_getSession()->addSuccess($message);
|
342 |
+
}
|
343 |
+
$this->_goBack();
|
344 |
+
}
|
345 |
+
} catch (Mage_Core_Exception $e) {
|
346 |
+
if ($this->_getSession()->getUseNotice(true)) {
|
347 |
+
$this->_getSession()->addNotice($e->getMessage());
|
348 |
+
} else {
|
349 |
+
$messages = array_unique(explode("\n", $e->getMessage()));
|
350 |
+
foreach ($messages as $message) {
|
351 |
+
$this->_getSession()->addError($message);
|
352 |
+
}
|
353 |
+
}
|
354 |
+
|
355 |
+
$url = $this->_getSession()->getRedirectUrl(true);
|
356 |
+
if ($url) {
|
357 |
+
$this->getResponse()->setRedirect($url);
|
358 |
+
} else {
|
359 |
+
$this->_redirectReferer(Mage::helper('checkout/cart')->getCartUrl());
|
360 |
+
}
|
361 |
+
} catch (Exception $e) {
|
362 |
+
$this->_getSession()->addException($e, $this->__('Cannot update the item.'));
|
363 |
+
Mage::logException($e);
|
364 |
+
$this->_goBack();
|
365 |
+
}
|
366 |
+
$this->_redirect('*/*');
|
367 |
+
}
|
368 |
+
|
369 |
+
/**
|
370 |
+
* Update shopping cart data action
|
371 |
+
*/
|
372 |
+
public function updatePostAction()
|
373 |
+
{
|
374 |
+
if (!$this->_validateFormKey()) {
|
375 |
+
$this->_redirect('*/*/');
|
376 |
+
return;
|
377 |
+
}
|
378 |
+
|
379 |
+
$updateAction = (string)$this->getRequest()->getParam('update_cart_action');
|
380 |
+
|
381 |
+
switch ($updateAction) {
|
382 |
+
case 'empty_cart':
|
383 |
+
$this->_emptyShoppingCart();
|
384 |
+
break;
|
385 |
+
case 'update_qty':
|
386 |
+
$this->_updateShoppingCart();
|
387 |
+
break;
|
388 |
+
default:
|
389 |
+
$this->_updateShoppingCart();
|
390 |
+
}
|
391 |
+
|
392 |
+
$this->_goBack();
|
393 |
+
}
|
394 |
+
|
395 |
+
/**
|
396 |
+
* Update customer's shopping cart
|
397 |
+
*/
|
398 |
+
protected function _updateShoppingCart()
|
399 |
+
{
|
400 |
+
try {
|
401 |
+
$cartData = $this->getRequest()->getParam('cart');
|
402 |
+
if (is_array($cartData)) {
|
403 |
+
$filter = new Zend_Filter_LocalizedToNormalized(
|
404 |
+
array('locale' => Mage::app()->getLocale()->getLocaleCode())
|
405 |
+
);
|
406 |
+
foreach ($cartData as $index => $data) {
|
407 |
+
if (isset($data['qty'])) {
|
408 |
+
$cartData[$index]['qty'] = $filter->filter(trim($data['qty']));
|
409 |
+
}
|
410 |
+
}
|
411 |
+
$cart = $this->_getCart();
|
412 |
+
if (! $cart->getCustomerSession()->getCustomer()->getId() && $cart->getQuote()->getCustomerId()) {
|
413 |
+
$cart->getQuote()->setCustomerId(null);
|
414 |
+
}
|
415 |
+
|
416 |
+
$cartData = $cart->suggestItemsQty($cartData);
|
417 |
+
$cart->updateItems($cartData)
|
418 |
+
->save();
|
419 |
+
}
|
420 |
+
$this->_getSession()->setCartWasUpdated(true);
|
421 |
+
} catch (Mage_Core_Exception $e) {
|
422 |
+
$this->_getSession()->addError(Mage::helper('core')->escapeHtml($e->getMessage()));
|
423 |
+
} catch (Exception $e) {
|
424 |
+
$this->_getSession()->addException($e, $this->__('Cannot update shopping cart.'));
|
425 |
+
Mage::logException($e);
|
426 |
+
}
|
427 |
+
}
|
428 |
+
|
429 |
+
/**
|
430 |
+
* Empty customer's shopping cart
|
431 |
+
*/
|
432 |
+
protected function _emptyShoppingCart()
|
433 |
+
{
|
434 |
+
try {
|
435 |
+
$this->_getCart()->truncate()->save();
|
436 |
+
$this->_getSession()->setCartWasUpdated(true);
|
437 |
+
/*Delete from table based on quote id*/
|
438 |
+
$session = Mage::getSingleton('checkout/session');
|
439 |
+
$quoteid = $session->getQuoteId();
|
440 |
+
$resource = Mage::getSingleton('core/resource');
|
441 |
+
$connection = $resource->getConnection('core_write');
|
442 |
+
$query = "Delete from `brst_freight_shipping` where quote_id=$quoteid";
|
443 |
+
$connection->query($query);
|
444 |
+
} catch (Mage_Core_Exception $exception) {
|
445 |
+
$this->_getSession()->addError($exception->getMessage());
|
446 |
+
} catch (Exception $exception) {
|
447 |
+
$this->_getSession()->addException($exception, $this->__('Cannot update shopping cart.'));
|
448 |
+
}
|
449 |
+
}
|
450 |
+
|
451 |
+
/**
|
452 |
+
* Delete shoping cart item action
|
453 |
+
*/
|
454 |
+
public function deleteAction()
|
455 |
+
{
|
456 |
+
$id = (int) $this->getRequest()->getParam('id');
|
457 |
+
if ($id) {
|
458 |
+
try {
|
459 |
+
$this->_getCart()->removeItem($id)
|
460 |
+
->save();
|
461 |
+
} catch (Exception $e) {
|
462 |
+
$this->_getSession()->addError($this->__('Cannot remove the item.'));
|
463 |
+
Mage::logException($e);
|
464 |
+
}
|
465 |
+
}
|
466 |
+
$this->_redirectReferer(Mage::getUrl('*/*'));
|
467 |
+
}
|
468 |
+
|
469 |
+
/**
|
470 |
+
* Initialize shipping information
|
471 |
+
*/
|
472 |
+
public function estimatePostAction()
|
473 |
+
{
|
474 |
+
$country = (string) $this->getRequest()->getParam('country_id');
|
475 |
+
$postcode = (string) $this->getRequest()->getParam('estimate_postcode');
|
476 |
+
$city = (string) $this->getRequest()->getParam('estimate_city');
|
477 |
+
$regionId = (string) $this->getRequest()->getParam('region_id');
|
478 |
+
$region = (string) $this->getRequest()->getParam('region');
|
479 |
+
|
480 |
+
$this->_getQuote()->getShippingAddress()
|
481 |
+
->setCountryId($country)
|
482 |
+
->setCity($city)
|
483 |
+
->setPostcode($postcode)
|
484 |
+
->setRegionId($regionId)
|
485 |
+
->setRegion($region)
|
486 |
+
->setCollectShippingRates(true);
|
487 |
+
$this->_getQuote()->save();
|
488 |
+
$this->_goBack();
|
489 |
+
}
|
490 |
+
|
491 |
+
/**
|
492 |
+
* Estimate update action
|
493 |
+
*
|
494 |
+
* @return null
|
495 |
+
*/
|
496 |
+
public function estimateUpdatePostAction()
|
497 |
+
{
|
498 |
+
$code = (string) $this->getRequest()->getParam('estimate_method');
|
499 |
+
if (!empty($code)) {
|
500 |
+
$this->_getQuote()->getShippingAddress()->setShippingMethod($code)/*->collectTotals()*/->save();
|
501 |
+
}
|
502 |
+
$this->_goBack();
|
503 |
+
}
|
504 |
+
|
505 |
+
/**
|
506 |
+
* Initialize coupon
|
507 |
+
*/
|
508 |
+
public function couponPostAction()
|
509 |
+
{
|
510 |
+
/**
|
511 |
+
* No reason continue with empty shopping cart
|
512 |
+
*/
|
513 |
+
if (!$this->_getCart()->getQuote()->getItemsCount()) {
|
514 |
+
$this->_goBack();
|
515 |
+
return;
|
516 |
+
}
|
517 |
+
|
518 |
+
$couponCode = (string) $this->getRequest()->getParam('coupon_code');
|
519 |
+
if ($this->getRequest()->getParam('remove') == 1) {
|
520 |
+
$couponCode = '';
|
521 |
+
}
|
522 |
+
$oldCouponCode = $this->_getQuote()->getCouponCode();
|
523 |
+
|
524 |
+
if (!strlen($couponCode) && !strlen($oldCouponCode)) {
|
525 |
+
$this->_goBack();
|
526 |
+
return;
|
527 |
+
}
|
528 |
+
|
529 |
+
try {
|
530 |
+
$codeLength = strlen($couponCode);
|
531 |
+
$isCodeLengthValid = $codeLength && $codeLength <= Mage_Checkout_Helper_Cart::COUPON_CODE_MAX_LENGTH;
|
532 |
+
|
533 |
+
$this->_getQuote()->getShippingAddress()->setCollectShippingRates(true);
|
534 |
+
$this->_getQuote()->setCouponCode($isCodeLengthValid ? $couponCode : '')
|
535 |
+
->collectTotals()
|
536 |
+
->save();
|
537 |
+
|
538 |
+
if ($codeLength) {
|
539 |
+
if ($isCodeLengthValid && $couponCode == $this->_getQuote()->getCouponCode()) {
|
540 |
+
$this->_getSession()->addSuccess(
|
541 |
+
$this->__('Coupon code "%s" was applied.', Mage::helper('core')->escapeHtml($couponCode))
|
542 |
+
);
|
543 |
+
} else {
|
544 |
+
$this->_getSession()->addError(
|
545 |
+
$this->__('Coupon code "%s" is not valid.', Mage::helper('core')->escapeHtml($couponCode))
|
546 |
+
);
|
547 |
+
}
|
548 |
+
} else {
|
549 |
+
$this->_getSession()->addSuccess($this->__('Coupon code was canceled.'));
|
550 |
+
}
|
551 |
+
|
552 |
+
} catch (Mage_Core_Exception $e) {
|
553 |
+
$this->_getSession()->addError($e->getMessage());
|
554 |
+
} catch (Exception $e) {
|
555 |
+
$this->_getSession()->addError($this->__('Cannot apply the coupon code.'));
|
556 |
+
Mage::logException($e);
|
557 |
+
}
|
558 |
+
|
559 |
+
$this->_goBack();
|
560 |
+
}
|
561 |
+
}
|
app/code/local/Freightcenter/Ship/controllers/IndexController.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Freightcenter_Ship_IndexController extends Mage_Core_Controller_Front_Action
|
3 |
+
{
|
4 |
+
|
5 |
+
}
|
app/code/local/Freightcenter/Ship/controllers/System/ConfigController.php
ADDED
@@ -0,0 +1,285 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once 'Mage/Adminhtml/controllers/System/ConfigController.php';
|
3 |
+
|
4 |
+
class Freightcenter_Ship_System_ConfigController extends Mage_Adminhtml_System_ConfigController
|
5 |
+
{
|
6 |
+
public function saveAction()
|
7 |
+
{
|
8 |
+
$session = Mage::getSingleton('adminhtml/session');
|
9 |
+
/* @var $session Mage_Adminhtml_Model_Session */
|
10 |
+
|
11 |
+
$groups = $this->getRequest()->getPost('groups');
|
12 |
+
|
13 |
+
if(isset($groups['freightcenter'])) {
|
14 |
+
/* function to convert xml to array */
|
15 |
+
function xmlToArray($input, $callback = null, $recurse = false) {
|
16 |
+
$data = ((!$recurse) && is_string($input))? simplexml_load_string($input, 'SimpleXMLElement', LIBXML_NOCDATA): $input;
|
17 |
+
if ($data instanceof SimpleXMLElement) $data = (array) $data;
|
18 |
+
if (is_array($data)) foreach ($data as &$item) $item = xmlToArray($item, $callback, true);
|
19 |
+
return (!is_array($data) && is_callable($callback))? call_user_func($callback, $data): $data;
|
20 |
+
}
|
21 |
+
$current_mode = $groups['freightcenter']['fields']['sandbox']['value'];
|
22 |
+
$username = $groups['freightcenter']['fields']['freightuser']['value'];
|
23 |
+
$password = $groups['freightcenter']['fields']['freightpwd']['value'];
|
24 |
+
/* if($current_mode == '1' ) {
|
25 |
+
$api_url_hit = 'http://sandbox.freightcenter.com/v04/carriers.asmx?op=GetActiveCarriers';
|
26 |
+
$xml='<?xml version="1.0" encoding="utf-8"?>
|
27 |
+
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
|
28 |
+
<soap12:Body>
|
29 |
+
<GetActiveCarriers xmlns="http://freightcenter.com/API/V04/">
|
30 |
+
<request>
|
31 |
+
<Username>'.$username.'</Username>
|
32 |
+
<Password>'.$password.'</Password>
|
33 |
+
<LicenseKey>3BDA740C-FF39-4BDC-AB49-B0A3C08E23B4</LicenseKey>
|
34 |
+
</request>
|
35 |
+
</GetActiveCarriers>
|
36 |
+
</soap12:Body>
|
37 |
+
</soap12:Envelope>';
|
38 |
+
|
39 |
+
}else{ */
|
40 |
+
$api_url_hit = 'http://api.freightcenter.com/v04/carriers.asmx?op=GetActiveCarriers';
|
41 |
+
$xml='<?xml version="1.0" encoding="utf-8"?>
|
42 |
+
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
|
43 |
+
<soap12:Body>
|
44 |
+
<GetActiveCarriers xmlns="http://freightcenter.com/API/V04/">
|
45 |
+
<request>
|
46 |
+
<Username>'.$username.'</Username>
|
47 |
+
<Password>'.$password.'</Password>
|
48 |
+
<LicenseKey>3BDA740C-FF39-4BDC-AB49-B0A3C08E23B4</LicenseKey>
|
49 |
+
</request>
|
50 |
+
</GetActiveCarriers>
|
51 |
+
</soap12:Body>
|
52 |
+
</soap12:Envelope>';
|
53 |
+
// }
|
54 |
+
|
55 |
+
//echo "<pre>";print_r($groups['freightcenter']);exit;
|
56 |
+
|
57 |
+
//$license_key = $groups['freightcenter']['fields']['freightlicensekey']['value'];
|
58 |
+
|
59 |
+
/* xml request */
|
60 |
+
|
61 |
+
|
62 |
+
/* if($current_mode == '1'){
|
63 |
+
|
64 |
+
$headers = array(
|
65 |
+
"POST /v04/carriers.asmx HTTP/1.1",
|
66 |
+
"Host: sandbox.freightcenter.com",
|
67 |
+
"Content-Type: application/soap+xml; charset=utf-8",
|
68 |
+
"Content-length: ".strlen($xml)
|
69 |
+
);
|
70 |
+
} else { */
|
71 |
+
$headers = array(
|
72 |
+
"POST /V04/carriers.asmx HTTP/1.1",
|
73 |
+
"Host: api.freightcenter.com",
|
74 |
+
"Content-type: application/soap+xml; charset=utf-8",
|
75 |
+
"Content-length: ".strlen($xml)
|
76 |
+
);
|
77 |
+
// }
|
78 |
+
/* send curl request to get active carriers */
|
79 |
+
$soap_do = curl_init();
|
80 |
+
curl_setopt($soap_do, CURLOPT_URL, $api_url_hit );
|
81 |
+
curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true );
|
82 |
+
curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false);
|
83 |
+
curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false);
|
84 |
+
curl_setopt($soap_do, CURLOPT_POST, true );
|
85 |
+
curl_setopt($soap_do, CURLOPT_HTTPHEADER, $headers);
|
86 |
+
curl_setopt($soap_do, CURLOPT_POSTFIELDS, $xml);
|
87 |
+
|
88 |
+
$result = curl_exec($soap_do);
|
89 |
+
curl_close($soap_do);
|
90 |
+
|
91 |
+
$get_result = preg_replace('/xmlns:.*\"/','',$result);
|
92 |
+
$get_response = preg_replace('<soap:>','',$get_result);
|
93 |
+
$get_response1 = preg_replace('<</GetActiveCarriersResponse>>','',$get_response);
|
94 |
+
$get_response2 = preg_replace('<</Body>>','',$get_response1);
|
95 |
+
$get_response3 = preg_replace('<</Text></Reason><Detail /></Fault>>','',$get_response2);
|
96 |
+
|
97 |
+
$output = xmlToArray($get_response3);
|
98 |
+
//echo "<pre>";print_r($output);exit;
|
99 |
+
|
100 |
+
if(isset($output[0])) {
|
101 |
+
$session->addError("Please check credentials!");
|
102 |
+
} else {
|
103 |
+
$response_type = $output['GetActiveCarriersResult']['TransactionResponse']['Type'];
|
104 |
+
if($response_type == 'SUCCESS') {
|
105 |
+
//echo "<pre>";print_r($output);
|
106 |
+
$carriers = $output['GetActiveCarriersResult']['Carriers']['Carrier'];
|
107 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
108 |
+
// echo '<pre>'; print_r($carriers); die('this');
|
109 |
+
$new_carriers = array();
|
110 |
+
foreach($carriers as $carrier) {
|
111 |
+
$carrierid = $carrier['CarrierId'];
|
112 |
+
$carrierscac = $carrier['CarrierSCAC'];
|
113 |
+
$carriercode = $carrier['CarrierCode'];
|
114 |
+
if($carriercode == NULL) {
|
115 |
+
$carriercode = '';
|
116 |
+
}
|
117 |
+
$carriername = $carrier['CarrierName'];
|
118 |
+
|
119 |
+
$new_carriers[] = $carrier['CarrierId'];
|
120 |
+
|
121 |
+
$carrier_query = $connection->query("select * from brst_freight_carriers where username='$username' AND carrierid = $carrierid");
|
122 |
+
$getcarrier = $carrier_query->fetchAll();
|
123 |
+
//echo "<pre>";print_r($getcarrier);exit;
|
124 |
+
if($getcarrier == NULL) {
|
125 |
+
$mysql = "INSERT INTO brst_freight_carriers (username,carrierid,carrier_scac,carrier_code,carrier_name) VALUES ('$username',$carrierid,'$carrierscac','$carriercode','$carriername')";
|
126 |
+
$connection->query($mysql);
|
127 |
+
}
|
128 |
+
}
|
129 |
+
|
130 |
+
$getcar_query = $connection->query("select * from brst_freight_carriers where username = '$username'");
|
131 |
+
$getcarriers = $getcar_query->fetchAll();
|
132 |
+
if($getcarriers != NULL) {
|
133 |
+
$all_carriers = array();
|
134 |
+
foreach($getcarriers as $car) {
|
135 |
+
$all_carriers[] = $car['carrierid'];
|
136 |
+
}
|
137 |
+
|
138 |
+
$newresult = array_diff($all_carriers,$new_carriers);
|
139 |
+
//echo '<pre>'; print_r($newresult); die('here');
|
140 |
+
if($newresult != NULL) {
|
141 |
+
foreach ($newresult as $nresult) {
|
142 |
+
//echo $nresult;
|
143 |
+
$mysql1 = "Delete from brst_freight_carriers where carrierid = $nresult AND username = '$username'";
|
144 |
+
$connection->query($mysql1);
|
145 |
+
//die('here');
|
146 |
+
}
|
147 |
+
}
|
148 |
+
}
|
149 |
+
|
150 |
+
if (isset($_FILES['groups']['name']) && is_array($_FILES['groups']['name'])) {
|
151 |
+
/**
|
152 |
+
* Carefully merge $_FILES and $_POST information
|
153 |
+
* None of '+=' or 'array_merge_recursive' can do this correct
|
154 |
+
*/
|
155 |
+
foreach($_FILES['groups']['name'] as $groupName => $group) {
|
156 |
+
if (is_array($group)) {
|
157 |
+
foreach ($group['fields'] as $fieldName => $field) {
|
158 |
+
if (!empty($field['value'])) {
|
159 |
+
$groups[$groupName]['fields'][$fieldName] = array('value' => $field['value']);
|
160 |
+
}
|
161 |
+
}
|
162 |
+
}
|
163 |
+
}
|
164 |
+
}
|
165 |
+
|
166 |
+
try {
|
167 |
+
if (!$this->_isSectionAllowed($this->getRequest()->getParam('section'))) {
|
168 |
+
throw new Exception(Mage::helper('adminhtml')->__('This section is not allowed.'));
|
169 |
+
}
|
170 |
+
|
171 |
+
// custom save logic
|
172 |
+
$this->_saveSection();
|
173 |
+
$section = $this->getRequest()->getParam('section');
|
174 |
+
$website = $this->getRequest()->getParam('website');
|
175 |
+
$store = $this->getRequest()->getParam('store');
|
176 |
+
Mage::getSingleton('adminhtml/config_data')
|
177 |
+
->setSection($section)
|
178 |
+
->setWebsite($website)
|
179 |
+
->setStore($store)
|
180 |
+
->setGroups($groups)
|
181 |
+
->save();
|
182 |
+
|
183 |
+
// reinit configuration
|
184 |
+
Mage::getConfig()->reinit();
|
185 |
+
Mage::dispatchEvent('admin_system_config_section_save_after', array(
|
186 |
+
'website' => $website,
|
187 |
+
'store' => $store,
|
188 |
+
'section' => $section
|
189 |
+
));
|
190 |
+
Mage::app()->reinitStores();
|
191 |
+
|
192 |
+
// website and store codes can be used in event implementation, so set them as well
|
193 |
+
Mage::dispatchEvent("admin_system_config_changed_section_{$section}",
|
194 |
+
array('website' => $website, 'store' => $store)
|
195 |
+
);
|
196 |
+
$session->addSuccess(Mage::helper('adminhtml')->__('The configuration has been saved.'));
|
197 |
+
}
|
198 |
+
catch (Mage_Core_Exception $e) {
|
199 |
+
foreach(explode("\n", $e->getMessage()) as $message) {
|
200 |
+
$session->addError($message);
|
201 |
+
}
|
202 |
+
}
|
203 |
+
catch (Exception $e) {
|
204 |
+
$session->addException($e,
|
205 |
+
Mage::helper('adminhtml')->__('An error occurred while saving this configuration:') . ' '
|
206 |
+
. $e->getMessage());
|
207 |
+
}
|
208 |
+
|
209 |
+
$this->_saveState($this->getRequest()->getPost('config_state'));
|
210 |
+
|
211 |
+
} else if($response_type == 'ERROR') {
|
212 |
+
$errormsg = $output['GetActiveCarriersResult']['TransactionResponse']['Message'];
|
213 |
+
$session->addError($errormsg);
|
214 |
+
}
|
215 |
+
}
|
216 |
+
|
217 |
+
} else {
|
218 |
+
|
219 |
+
if (isset($_FILES['groups']['name']) && is_array($_FILES['groups']['name'])) {
|
220 |
+
/**
|
221 |
+
* Carefully merge $_FILES and $_POST information
|
222 |
+
* None of '+=' or 'array_merge_recursive' can do this correct
|
223 |
+
*/
|
224 |
+
foreach($_FILES['groups']['name'] as $groupName => $group) {
|
225 |
+
if (is_array($group)) {
|
226 |
+
foreach ($group['fields'] as $fieldName => $field) {
|
227 |
+
if (!empty($field['value'])) {
|
228 |
+
$groups[$groupName]['fields'][$fieldName] = array('value' => $field['value']);
|
229 |
+
}
|
230 |
+
}
|
231 |
+
}
|
232 |
+
}
|
233 |
+
}
|
234 |
+
|
235 |
+
try {
|
236 |
+
if (!$this->_isSectionAllowed($this->getRequest()->getParam('section'))) {
|
237 |
+
throw new Exception(Mage::helper('adminhtml')->__('This section is not allowed.'));
|
238 |
+
}
|
239 |
+
|
240 |
+
// custom save logic
|
241 |
+
$this->_saveSection();
|
242 |
+
$section = $this->getRequest()->getParam('section');
|
243 |
+
$website = $this->getRequest()->getParam('website');
|
244 |
+
$store = $this->getRequest()->getParam('store');
|
245 |
+
Mage::getSingleton('adminhtml/config_data')
|
246 |
+
->setSection($section)
|
247 |
+
->setWebsite($website)
|
248 |
+
->setStore($store)
|
249 |
+
->setGroups($groups)
|
250 |
+
->save();
|
251 |
+
|
252 |
+
// reinit configuration
|
253 |
+
Mage::getConfig()->reinit();
|
254 |
+
Mage::dispatchEvent('admin_system_config_section_save_after', array(
|
255 |
+
'website' => $website,
|
256 |
+
'store' => $store,
|
257 |
+
'section' => $section
|
258 |
+
));
|
259 |
+
Mage::app()->reinitStores();
|
260 |
+
|
261 |
+
// website and store codes can be used in event implementation, so set them as well
|
262 |
+
Mage::dispatchEvent("admin_system_config_changed_section_{$section}",
|
263 |
+
array('website' => $website, 'store' => $store)
|
264 |
+
);
|
265 |
+
$session->addSuccess(Mage::helper('adminhtml')->__('The configuration has been saved.'));
|
266 |
+
}
|
267 |
+
catch (Mage_Core_Exception $e) {
|
268 |
+
foreach(explode("\n", $e->getMessage()) as $message) {
|
269 |
+
$session->addError($message);
|
270 |
+
}
|
271 |
+
}
|
272 |
+
catch (Exception $e) {
|
273 |
+
$session->addException($e,
|
274 |
+
Mage::helper('adminhtml')->__('An error occurred while saving this configuration:') . ' '
|
275 |
+
. $e->getMessage());
|
276 |
+
}
|
277 |
+
|
278 |
+
$this->_saveState($this->getRequest()->getPost('config_state'));
|
279 |
+
}
|
280 |
+
|
281 |
+
$this->_redirect('*/*/edit', array('_current' => array('section', 'website', 'store')));
|
282 |
+
}
|
283 |
+
}
|
284 |
+
|
285 |
+
?>
|
app/code/local/Freightcenter/Ship/controllers/System/ConfigController.php@1Aug
ADDED
@@ -0,0 +1,282 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once 'Mage/Adminhtml/controllers/System/ConfigController.php';
|
3 |
+
|
4 |
+
class Freightcenter_Ship_System_ConfigController extends Mage_Adminhtml_System_ConfigController
|
5 |
+
{
|
6 |
+
public function saveAction()
|
7 |
+
{
|
8 |
+
$session = Mage::getSingleton('adminhtml/session');
|
9 |
+
/* @var $session Mage_Adminhtml_Model_Session */
|
10 |
+
|
11 |
+
$groups = $this->getRequest()->getPost('groups');
|
12 |
+
|
13 |
+
if(isset($groups['freightcenter'])) {
|
14 |
+
/* function to convert xml to array */
|
15 |
+
function xmlToArray($input, $callback = null, $recurse = false) {
|
16 |
+
$data = ((!$recurse) && is_string($input))? simplexml_load_string($input, 'SimpleXMLElement', LIBXML_NOCDATA): $input;
|
17 |
+
if ($data instanceof SimpleXMLElement) $data = (array) $data;
|
18 |
+
if (is_array($data)) foreach ($data as &$item) $item = xmlToArray($item, $callback, true);
|
19 |
+
return (!is_array($data) && is_callable($callback))? call_user_func($callback, $data): $data;
|
20 |
+
}
|
21 |
+
$current_mode = $groups['freightcenter']['fields']['sandbox']['value'];
|
22 |
+
$username = $groups['freightcenter']['fields']['freightuser']['value'];
|
23 |
+
$password = $groups['freightcenter']['fields']['freightpwd']['value'];
|
24 |
+
if($current_mode == '1' ) {
|
25 |
+
$api_url_hit = 'http://sandbox.freightcenter.com/v03/carriers.asmx?op=GetActiveCarriers';
|
26 |
+
$xml='<?xml version="1.0" encoding="utf-8"?>
|
27 |
+
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
|
28 |
+
<soap12:Body>
|
29 |
+
<GetActiveCarriers xmlns="http://freightcenter.com/API/V03/">
|
30 |
+
<request>
|
31 |
+
<Username>'.$username.'</Username>
|
32 |
+
<Password>'.$password.'</Password>
|
33 |
+
<LicenseKey>D3217D78-8ACB-4C6A-8C38-A5F5266C9BCE</LicenseKey>
|
34 |
+
</request>
|
35 |
+
</GetActiveCarriers>
|
36 |
+
</soap12:Body>
|
37 |
+
</soap12:Envelope>';
|
38 |
+
|
39 |
+
}else{
|
40 |
+
$api_url_hit = 'http://api.freightcenter.com/v03/carriers.asmx?op=GetActiveCarriers';
|
41 |
+
$xml='<?xml version="1.0" encoding="utf-8"?>
|
42 |
+
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
|
43 |
+
<soap12:Body>
|
44 |
+
<GetActiveCarriers xmlns="http://freightcenter.com/API/V03/">
|
45 |
+
<request>
|
46 |
+
<Username>'.$username.'</Username>
|
47 |
+
<Password>'.$password.'</Password>
|
48 |
+
<LicenseKey>3BDA740C-FF39-4BDC-AB49-B0A3C08E23B4</LicenseKey>
|
49 |
+
</request>
|
50 |
+
</GetActiveCarriers>
|
51 |
+
</soap12:Body>
|
52 |
+
</soap12:Envelope>';
|
53 |
+
}
|
54 |
+
|
55 |
+
//echo "<pre>";print_r($groups['freightcenter']);exit;
|
56 |
+
|
57 |
+
//$license_key = $groups['freightcenter']['fields']['freightlicensekey']['value'];
|
58 |
+
|
59 |
+
/* xml request */
|
60 |
+
|
61 |
+
|
62 |
+
if($current_mode == '1'){
|
63 |
+
|
64 |
+
$headers = array(
|
65 |
+
"POST /v03/carriers.asmx HTTP/1.1",
|
66 |
+
"Host: sandbox.freightcenter.com",
|
67 |
+
"Content-Type: application/soap+xml; charset=utf-8",
|
68 |
+
"Content-length: ".strlen($xml)
|
69 |
+
);
|
70 |
+
} else {
|
71 |
+
$headers = array(
|
72 |
+
"POST /V03/carriers.asmx HTTP/1.1",
|
73 |
+
"Host: api.freightcenter.com",
|
74 |
+
"Content-type: application/soap+xml; charset=utf-8",
|
75 |
+
"Content-length: ".strlen($xml)
|
76 |
+
);
|
77 |
+
}
|
78 |
+
/* send curl request to get active carriers */
|
79 |
+
$soap_do = curl_init();
|
80 |
+
curl_setopt($soap_do, CURLOPT_URL, $api_url_hit );
|
81 |
+
curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true );
|
82 |
+
curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false);
|
83 |
+
curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false);
|
84 |
+
curl_setopt($soap_do, CURLOPT_POST, true );
|
85 |
+
curl_setopt($soap_do, CURLOPT_HTTPHEADER, $headers);
|
86 |
+
curl_setopt($soap_do, CURLOPT_POSTFIELDS, $xml);
|
87 |
+
|
88 |
+
$result = curl_exec($soap_do);
|
89 |
+
curl_close($soap_do);
|
90 |
+
|
91 |
+
$get_result = preg_replace('/xmlns:.*\"/','',$result);
|
92 |
+
$get_response = preg_replace('<soap:>','',$get_result);
|
93 |
+
$get_response1 = preg_replace('<</GetActiveCarriersResponse>>','',$get_response);
|
94 |
+
$get_response2 = preg_replace('<</Body>>','',$get_response1);
|
95 |
+
$get_response3 = preg_replace('<</Text></Reason><Detail /></Fault>>','',$get_response2);
|
96 |
+
|
97 |
+
$output = xmlToArray($get_response3);
|
98 |
+
//echo "<pre>";print_r($output);exit;
|
99 |
+
|
100 |
+
if(isset($output[0])) {
|
101 |
+
$session->addError("Please check credentials!");
|
102 |
+
} else {
|
103 |
+
$response_type = $output['GetActiveCarriersResult']['TransactionResponse']['Type'];
|
104 |
+
if($response_type == 'SUCCESS') {
|
105 |
+
//echo "<pre>";print_r($output);
|
106 |
+
$carriers = $output['GetActiveCarriersResult']['Carriers']['Carrier'];
|
107 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
108 |
+
|
109 |
+
$new_carriers = array();
|
110 |
+
foreach($carriers as $carrier) {
|
111 |
+
$carrierid = $carrier['CarrierId'];
|
112 |
+
$carrierscac = $carrier['CarrierSCAC'];
|
113 |
+
$carriercode = $carrier['CarrierCode'];
|
114 |
+
if($carriercode == NULL) {
|
115 |
+
$carriercode = '';
|
116 |
+
}
|
117 |
+
$carriername = $carrier['CarrierName'];
|
118 |
+
|
119 |
+
$new_carriers[] = $carrier['CarrierId'];
|
120 |
+
|
121 |
+
$carrier_query = $connection->query("select * from brst_freight_carriers where username='$username' AND carrierid = $carrierid");
|
122 |
+
$getcarrier = $carrier_query->fetchAll();
|
123 |
+
//echo "<pre>";print_r($getcarrier);exit;
|
124 |
+
if($getcarrier == NULL) {
|
125 |
+
$mysql = "INSERT INTO brst_freight_carriers (username,carrierid,carrier_scac,carrier_code,carrier_name) VALUES ('$username',$carrierid,'$carrierscac','$carriercode','$carriername')";
|
126 |
+
$connection->query($mysql);
|
127 |
+
}
|
128 |
+
}
|
129 |
+
|
130 |
+
$getcar_query = $connection->query("select * from brst_freight_carriers where username = '$username'");
|
131 |
+
$getcarriers = $getcar_query->fetchAll();
|
132 |
+
if($getcarriers != NULL) {
|
133 |
+
$all_carriers = array();
|
134 |
+
foreach($getcarriers as $car) {
|
135 |
+
$all_carriers[] = $car['carrierid'];
|
136 |
+
}
|
137 |
+
|
138 |
+
$newresult = array_diff($all_carriers,$new_carriers);
|
139 |
+
if($newresult != NULL) {
|
140 |
+
foreach ($newresult as $nresult) {
|
141 |
+
$mysql1 = "Delete from brst_freight_carriers where carrierid = $nresult AND username = '$username')";
|
142 |
+
$connection->query($mysql1);
|
143 |
+
}
|
144 |
+
}
|
145 |
+
}
|
146 |
+
|
147 |
+
if (isset($_FILES['groups']['name']) && is_array($_FILES['groups']['name'])) {
|
148 |
+
/**
|
149 |
+
* Carefully merge $_FILES and $_POST information
|
150 |
+
* None of '+=' or 'array_merge_recursive' can do this correct
|
151 |
+
*/
|
152 |
+
foreach($_FILES['groups']['name'] as $groupName => $group) {
|
153 |
+
if (is_array($group)) {
|
154 |
+
foreach ($group['fields'] as $fieldName => $field) {
|
155 |
+
if (!empty($field['value'])) {
|
156 |
+
$groups[$groupName]['fields'][$fieldName] = array('value' => $field['value']);
|
157 |
+
}
|
158 |
+
}
|
159 |
+
}
|
160 |
+
}
|
161 |
+
}
|
162 |
+
|
163 |
+
try {
|
164 |
+
if (!$this->_isSectionAllowed($this->getRequest()->getParam('section'))) {
|
165 |
+
throw new Exception(Mage::helper('adminhtml')->__('This section is not allowed.'));
|
166 |
+
}
|
167 |
+
|
168 |
+
// custom save logic
|
169 |
+
$this->_saveSection();
|
170 |
+
$section = $this->getRequest()->getParam('section');
|
171 |
+
$website = $this->getRequest()->getParam('website');
|
172 |
+
$store = $this->getRequest()->getParam('store');
|
173 |
+
Mage::getSingleton('adminhtml/config_data')
|
174 |
+
->setSection($section)
|
175 |
+
->setWebsite($website)
|
176 |
+
->setStore($store)
|
177 |
+
->setGroups($groups)
|
178 |
+
->save();
|
179 |
+
|
180 |
+
// reinit configuration
|
181 |
+
Mage::getConfig()->reinit();
|
182 |
+
Mage::dispatchEvent('admin_system_config_section_save_after', array(
|
183 |
+
'website' => $website,
|
184 |
+
'store' => $store,
|
185 |
+
'section' => $section
|
186 |
+
));
|
187 |
+
Mage::app()->reinitStores();
|
188 |
+
|
189 |
+
// website and store codes can be used in event implementation, so set them as well
|
190 |
+
Mage::dispatchEvent("admin_system_config_changed_section_{$section}",
|
191 |
+
array('website' => $website, 'store' => $store)
|
192 |
+
);
|
193 |
+
$session->addSuccess(Mage::helper('adminhtml')->__('The configuration has been saved.'));
|
194 |
+
}
|
195 |
+
catch (Mage_Core_Exception $e) {
|
196 |
+
foreach(explode("\n", $e->getMessage()) as $message) {
|
197 |
+
$session->addError($message);
|
198 |
+
}
|
199 |
+
}
|
200 |
+
catch (Exception $e) {
|
201 |
+
$session->addException($e,
|
202 |
+
Mage::helper('adminhtml')->__('An error occurred while saving this configuration:') . ' '
|
203 |
+
. $e->getMessage());
|
204 |
+
}
|
205 |
+
|
206 |
+
$this->_saveState($this->getRequest()->getPost('config_state'));
|
207 |
+
|
208 |
+
} else if($response_type == 'ERROR') {
|
209 |
+
$errormsg = $output['GetActiveCarriersResult']['TransactionResponse']['Message'];
|
210 |
+
$session->addError($errormsg);
|
211 |
+
}
|
212 |
+
}
|
213 |
+
|
214 |
+
} else {
|
215 |
+
|
216 |
+
if (isset($_FILES['groups']['name']) && is_array($_FILES['groups']['name'])) {
|
217 |
+
/**
|
218 |
+
* Carefully merge $_FILES and $_POST information
|
219 |
+
* None of '+=' or 'array_merge_recursive' can do this correct
|
220 |
+
*/
|
221 |
+
foreach($_FILES['groups']['name'] as $groupName => $group) {
|
222 |
+
if (is_array($group)) {
|
223 |
+
foreach ($group['fields'] as $fieldName => $field) {
|
224 |
+
if (!empty($field['value'])) {
|
225 |
+
$groups[$groupName]['fields'][$fieldName] = array('value' => $field['value']);
|
226 |
+
}
|
227 |
+
}
|
228 |
+
}
|
229 |
+
}
|
230 |
+
}
|
231 |
+
|
232 |
+
try {
|
233 |
+
if (!$this->_isSectionAllowed($this->getRequest()->getParam('section'))) {
|
234 |
+
throw new Exception(Mage::helper('adminhtml')->__('This section is not allowed.'));
|
235 |
+
}
|
236 |
+
|
237 |
+
// custom save logic
|
238 |
+
$this->_saveSection();
|
239 |
+
$section = $this->getRequest()->getParam('section');
|
240 |
+
$website = $this->getRequest()->getParam('website');
|
241 |
+
$store = $this->getRequest()->getParam('store');
|
242 |
+
Mage::getSingleton('adminhtml/config_data')
|
243 |
+
->setSection($section)
|
244 |
+
->setWebsite($website)
|
245 |
+
->setStore($store)
|
246 |
+
->setGroups($groups)
|
247 |
+
->save();
|
248 |
+
|
249 |
+
// reinit configuration
|
250 |
+
Mage::getConfig()->reinit();
|
251 |
+
Mage::dispatchEvent('admin_system_config_section_save_after', array(
|
252 |
+
'website' => $website,
|
253 |
+
'store' => $store,
|
254 |
+
'section' => $section
|
255 |
+
));
|
256 |
+
Mage::app()->reinitStores();
|
257 |
+
|
258 |
+
// website and store codes can be used in event implementation, so set them as well
|
259 |
+
Mage::dispatchEvent("admin_system_config_changed_section_{$section}",
|
260 |
+
array('website' => $website, 'store' => $store)
|
261 |
+
);
|
262 |
+
$session->addSuccess(Mage::helper('adminhtml')->__('The configuration has been saved.'));
|
263 |
+
}
|
264 |
+
catch (Mage_Core_Exception $e) {
|
265 |
+
foreach(explode("\n", $e->getMessage()) as $message) {
|
266 |
+
$session->addError($message);
|
267 |
+
}
|
268 |
+
}
|
269 |
+
catch (Exception $e) {
|
270 |
+
$session->addException($e,
|
271 |
+
Mage::helper('adminhtml')->__('An error occurred while saving this configuration:') . ' '
|
272 |
+
. $e->getMessage());
|
273 |
+
}
|
274 |
+
|
275 |
+
$this->_saveState($this->getRequest()->getPost('config_state'));
|
276 |
+
}
|
277 |
+
|
278 |
+
$this->_redirect('*/*/edit', array('_current' => array('section', 'website', 'store')));
|
279 |
+
}
|
280 |
+
}
|
281 |
+
|
282 |
+
?>
|
app/code/local/Freightcenter/Ship/controllers/System/ConfigController.php@26June
ADDED
@@ -0,0 +1,253 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once 'Mage/Adminhtml/controllers/System/ConfigController.php';
|
3 |
+
|
4 |
+
class Freightcenter_Ship_System_ConfigController extends Mage_Adminhtml_System_ConfigController
|
5 |
+
{
|
6 |
+
public function saveAction()
|
7 |
+
{
|
8 |
+
$session = Mage::getSingleton('adminhtml/session');
|
9 |
+
/* @var $session Mage_Adminhtml_Model_Session */
|
10 |
+
|
11 |
+
$groups = $this->getRequest()->getPost('groups');
|
12 |
+
|
13 |
+
if(isset($groups['freightcenter'])) {
|
14 |
+
/* function to convert xml to array */
|
15 |
+
function xmlToArray($input, $callback = null, $recurse = false) {
|
16 |
+
$data = ((!$recurse) && is_string($input))? simplexml_load_string($input, 'SimpleXMLElement', LIBXML_NOCDATA): $input;
|
17 |
+
if ($data instanceof SimpleXMLElement) $data = (array) $data;
|
18 |
+
if (is_array($data)) foreach ($data as &$item) $item = xmlToArray($item, $callback, true);
|
19 |
+
return (!is_array($data) && is_callable($callback))? call_user_func($callback, $data): $data;
|
20 |
+
}
|
21 |
+
|
22 |
+
//echo "<pre>";print_r($groups['freightcenter']);exit;
|
23 |
+
$username = $groups['freightcenter']['fields']['freightuser']['value'];
|
24 |
+
$password = $groups['freightcenter']['fields']['freightpwd']['value'];
|
25 |
+
//$license_key = $groups['freightcenter']['fields']['freightlicensekey']['value'];
|
26 |
+
|
27 |
+
/* xml request */
|
28 |
+
$xml='<?xml version="1.0" encoding="utf-8"?>
|
29 |
+
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
|
30 |
+
<soap12:Body>
|
31 |
+
<GetActiveCarriers xmlns="http://freightcenter.com/API/V03/">
|
32 |
+
<request>
|
33 |
+
<Username>'.$username.'</Username>
|
34 |
+
<Password>'.$password.'</Password>
|
35 |
+
<LicenseKey>3BDA740C-FF39-4BDC-AB49-B0A3C08E23B4</LicenseKey>
|
36 |
+
</request>
|
37 |
+
</GetActiveCarriers>
|
38 |
+
</soap12:Body>
|
39 |
+
</soap12:Envelope>';
|
40 |
+
$apiurl = 'http://sandbox.freightcenter.com/v03/carriers.asmx?op=GetActiveCarriers';
|
41 |
+
|
42 |
+
$headers = array(
|
43 |
+
"POST /V03/carriers.asmx HTTP/1.1",
|
44 |
+
"Host: sandbox.freightcenter.com",
|
45 |
+
"Content-type: application/soap+xml; charset=utf-8",
|
46 |
+
"Content-length: ".strlen($xml)
|
47 |
+
);
|
48 |
+
|
49 |
+
/* send curl request to get active carriers */
|
50 |
+
$soap_do = curl_init();
|
51 |
+
curl_setopt($soap_do, CURLOPT_URL, $apiurl );
|
52 |
+
curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true );
|
53 |
+
curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false);
|
54 |
+
curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false);
|
55 |
+
curl_setopt($soap_do, CURLOPT_POST, true );
|
56 |
+
curl_setopt($soap_do, CURLOPT_HTTPHEADER, $headers);
|
57 |
+
curl_setopt($soap_do, CURLOPT_POSTFIELDS, $xml);
|
58 |
+
|
59 |
+
$result = curl_exec($soap_do);
|
60 |
+
curl_close($soap_do);
|
61 |
+
|
62 |
+
$get_result = preg_replace('/xmlns:.*\"/','',$result);
|
63 |
+
$get_response = preg_replace('<soap:>','',$get_result);
|
64 |
+
$get_response1 = preg_replace('<</GetActiveCarriersResponse>>','',$get_response);
|
65 |
+
$get_response2 = preg_replace('<</Body>>','',$get_response1);
|
66 |
+
$get_response3 = preg_replace('<</Text></Reason><Detail /></Fault>>','',$get_response2);
|
67 |
+
|
68 |
+
$output = xmlToArray($get_response3);
|
69 |
+
//echo "<pre>";print_r($output);exit;
|
70 |
+
|
71 |
+
if(isset($output[0])) {
|
72 |
+
$session->addError("Please check credentials!");
|
73 |
+
} else {
|
74 |
+
$response_type = $output['GetActiveCarriersResult']['TransactionResponse']['Type'];
|
75 |
+
if($response_type == 'SUCCESS') {
|
76 |
+
//echo "<pre>";print_r($output);
|
77 |
+
$carriers = $output['GetActiveCarriersResult']['Carriers']['Carrier'];
|
78 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
79 |
+
|
80 |
+
$new_carriers = array();
|
81 |
+
foreach($carriers as $carrier) {
|
82 |
+
$carrierid = $carrier['CarrierId'];
|
83 |
+
$carrierscac = $carrier['CarrierSCAC'];
|
84 |
+
$carriercode = $carrier['CarrierCode'];
|
85 |
+
if($carriercode == NULL) {
|
86 |
+
$carriercode = '';
|
87 |
+
}
|
88 |
+
$carriername = $carrier['CarrierName'];
|
89 |
+
|
90 |
+
$new_carriers[] = $carrier['CarrierId'];
|
91 |
+
|
92 |
+
$carrier_query = $connection->query("select * from brst_freight_carriers where username='$username' AND carrierid = $carrierid");
|
93 |
+
$getcarrier = $carrier_query->fetchAll();
|
94 |
+
//echo "<pre>";print_r($getcarrier);exit;
|
95 |
+
if($getcarrier == NULL) {
|
96 |
+
$mysql = "INSERT INTO brst_freight_carriers (username,carrierid,carrier_scac,carrier_code,carrier_name) VALUES ('$username',$carrierid,'$carrierscac','$carriercode','$carriername')";
|
97 |
+
$connection->query($mysql);
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
$getcar_query = $connection->query("select * from brst_freight_carriers where username = '$username'");
|
102 |
+
$getcarriers = $getcar_query->fetchAll();
|
103 |
+
if($getcarriers != NULL) {
|
104 |
+
$all_carriers = array();
|
105 |
+
foreach($getcarriers as $car) {
|
106 |
+
$all_carriers[] = $car['carrierid'];
|
107 |
+
}
|
108 |
+
|
109 |
+
$newresult = array_diff($all_carriers,$new_carriers);
|
110 |
+
if($newresult != NULL) {
|
111 |
+
foreach ($newresult as $nresult) {
|
112 |
+
$mysql1 = "Delete from brst_freight_carriers where carrierid = $nresult AND username = '$username')";
|
113 |
+
$connection->query($mysql1);
|
114 |
+
}
|
115 |
+
}
|
116 |
+
}
|
117 |
+
|
118 |
+
if (isset($_FILES['groups']['name']) && is_array($_FILES['groups']['name'])) {
|
119 |
+
/**
|
120 |
+
* Carefully merge $_FILES and $_POST information
|
121 |
+
* None of '+=' or 'array_merge_recursive' can do this correct
|
122 |
+
*/
|
123 |
+
foreach($_FILES['groups']['name'] as $groupName => $group) {
|
124 |
+
if (is_array($group)) {
|
125 |
+
foreach ($group['fields'] as $fieldName => $field) {
|
126 |
+
if (!empty($field['value'])) {
|
127 |
+
$groups[$groupName]['fields'][$fieldName] = array('value' => $field['value']);
|
128 |
+
}
|
129 |
+
}
|
130 |
+
}
|
131 |
+
}
|
132 |
+
}
|
133 |
+
|
134 |
+
try {
|
135 |
+
if (!$this->_isSectionAllowed($this->getRequest()->getParam('section'))) {
|
136 |
+
throw new Exception(Mage::helper('adminhtml')->__('This section is not allowed.'));
|
137 |
+
}
|
138 |
+
|
139 |
+
// custom save logic
|
140 |
+
$this->_saveSection();
|
141 |
+
$section = $this->getRequest()->getParam('section');
|
142 |
+
$website = $this->getRequest()->getParam('website');
|
143 |
+
$store = $this->getRequest()->getParam('store');
|
144 |
+
Mage::getSingleton('adminhtml/config_data')
|
145 |
+
->setSection($section)
|
146 |
+
->setWebsite($website)
|
147 |
+
->setStore($store)
|
148 |
+
->setGroups($groups)
|
149 |
+
->save();
|
150 |
+
|
151 |
+
// reinit configuration
|
152 |
+
Mage::getConfig()->reinit();
|
153 |
+
Mage::dispatchEvent('admin_system_config_section_save_after', array(
|
154 |
+
'website' => $website,
|
155 |
+
'store' => $store,
|
156 |
+
'section' => $section
|
157 |
+
));
|
158 |
+
Mage::app()->reinitStores();
|
159 |
+
|
160 |
+
// website and store codes can be used in event implementation, so set them as well
|
161 |
+
Mage::dispatchEvent("admin_system_config_changed_section_{$section}",
|
162 |
+
array('website' => $website, 'store' => $store)
|
163 |
+
);
|
164 |
+
$session->addSuccess(Mage::helper('adminhtml')->__('The configuration has been saved.'));
|
165 |
+
}
|
166 |
+
catch (Mage_Core_Exception $e) {
|
167 |
+
foreach(explode("\n", $e->getMessage()) as $message) {
|
168 |
+
$session->addError($message);
|
169 |
+
}
|
170 |
+
}
|
171 |
+
catch (Exception $e) {
|
172 |
+
$session->addException($e,
|
173 |
+
Mage::helper('adminhtml')->__('An error occurred while saving this configuration:') . ' '
|
174 |
+
. $e->getMessage());
|
175 |
+
}
|
176 |
+
|
177 |
+
$this->_saveState($this->getRequest()->getPost('config_state'));
|
178 |
+
|
179 |
+
} else if($response_type == 'ERROR') {
|
180 |
+
$errormsg = $output['GetActiveCarriersResult']['TransactionResponse']['Message'];
|
181 |
+
$session->addError($errormsg);
|
182 |
+
}
|
183 |
+
}
|
184 |
+
|
185 |
+
} else {
|
186 |
+
|
187 |
+
if (isset($_FILES['groups']['name']) && is_array($_FILES['groups']['name'])) {
|
188 |
+
/**
|
189 |
+
* Carefully merge $_FILES and $_POST information
|
190 |
+
* None of '+=' or 'array_merge_recursive' can do this correct
|
191 |
+
*/
|
192 |
+
foreach($_FILES['groups']['name'] as $groupName => $group) {
|
193 |
+
if (is_array($group)) {
|
194 |
+
foreach ($group['fields'] as $fieldName => $field) {
|
195 |
+
if (!empty($field['value'])) {
|
196 |
+
$groups[$groupName]['fields'][$fieldName] = array('value' => $field['value']);
|
197 |
+
}
|
198 |
+
}
|
199 |
+
}
|
200 |
+
}
|
201 |
+
}
|
202 |
+
|
203 |
+
try {
|
204 |
+
if (!$this->_isSectionAllowed($this->getRequest()->getParam('section'))) {
|
205 |
+
throw new Exception(Mage::helper('adminhtml')->__('This section is not allowed.'));
|
206 |
+
}
|
207 |
+
|
208 |
+
// custom save logic
|
209 |
+
$this->_saveSection();
|
210 |
+
$section = $this->getRequest()->getParam('section');
|
211 |
+
$website = $this->getRequest()->getParam('website');
|
212 |
+
$store = $this->getRequest()->getParam('store');
|
213 |
+
Mage::getSingleton('adminhtml/config_data')
|
214 |
+
->setSection($section)
|
215 |
+
->setWebsite($website)
|
216 |
+
->setStore($store)
|
217 |
+
->setGroups($groups)
|
218 |
+
->save();
|
219 |
+
|
220 |
+
// reinit configuration
|
221 |
+
Mage::getConfig()->reinit();
|
222 |
+
Mage::dispatchEvent('admin_system_config_section_save_after', array(
|
223 |
+
'website' => $website,
|
224 |
+
'store' => $store,
|
225 |
+
'section' => $section
|
226 |
+
));
|
227 |
+
Mage::app()->reinitStores();
|
228 |
+
|
229 |
+
// website and store codes can be used in event implementation, so set them as well
|
230 |
+
Mage::dispatchEvent("admin_system_config_changed_section_{$section}",
|
231 |
+
array('website' => $website, 'store' => $store)
|
232 |
+
);
|
233 |
+
$session->addSuccess(Mage::helper('adminhtml')->__('The configuration has been saved.'));
|
234 |
+
}
|
235 |
+
catch (Mage_Core_Exception $e) {
|
236 |
+
foreach(explode("\n", $e->getMessage()) as $message) {
|
237 |
+
$session->addError($message);
|
238 |
+
}
|
239 |
+
}
|
240 |
+
catch (Exception $e) {
|
241 |
+
$session->addException($e,
|
242 |
+
Mage::helper('adminhtml')->__('An error occurred while saving this configuration:') . ' '
|
243 |
+
. $e->getMessage());
|
244 |
+
}
|
245 |
+
|
246 |
+
$this->_saveState($this->getRequest()->getPost('config_state'));
|
247 |
+
}
|
248 |
+
|
249 |
+
$this->_redirect('*/*/edit', array('_current' => array('section', 'website', 'store')));
|
250 |
+
}
|
251 |
+
}
|
252 |
+
|
253 |
+
?>
|
app/code/local/Freightcenter/Ship/controllers/System/ConfigController_org23rdMay.php
ADDED
@@ -0,0 +1,257 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once 'Mage/Adminhtml/controllers/System/ConfigController.php';
|
3 |
+
|
4 |
+
class Freightcenter_Ship_System_ConfigController extends Mage_Adminhtml_System_ConfigController
|
5 |
+
{
|
6 |
+
public function saveAction()
|
7 |
+
{
|
8 |
+
$session = Mage::getSingleton('adminhtml/session');
|
9 |
+
/* @var $session Mage_Adminhtml_Model_Session */
|
10 |
+
|
11 |
+
$groups = $this->getRequest()->getPost('groups');
|
12 |
+
//$address = $this->getAddressCollection();
|
13 |
+
|
14 |
+
$model = Mage::getSingleton('freightcenter_customware/collect');
|
15 |
+
echo "<pre>";print_r($address);exit;
|
16 |
+
|
17 |
+
if(isset($groups['freightcenter'])) {
|
18 |
+
/* function to convert xml to array */
|
19 |
+
function xmlToArray($input, $callback = null, $recurse = false) {
|
20 |
+
$data = ((!$recurse) && is_string($input))? simplexml_load_string($input, 'SimpleXMLElement', LIBXML_NOCDATA): $input;
|
21 |
+
if ($data instanceof SimpleXMLElement) $data = (array) $data;
|
22 |
+
if (is_array($data)) foreach ($data as &$item) $item = xmlToArray($item, $callback, true);
|
23 |
+
return (!is_array($data) && is_callable($callback))? call_user_func($callback, $data): $data;
|
24 |
+
}
|
25 |
+
|
26 |
+
//echo "<pre>";print_r($groups['freightcenter']);exit;
|
27 |
+
$username = $groups['freightcenter']['fields']['freightuser']['value'];
|
28 |
+
$password = $groups['freightcenter']['fields']['freightpwd']['value'];
|
29 |
+
//$license_key = $groups['freightcenter']['fields']['freightlicensekey']['value'];
|
30 |
+
|
31 |
+
/* xml request */
|
32 |
+
$xml='<?xml version="1.0" encoding="utf-8"?>
|
33 |
+
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
|
34 |
+
<soap12:Body>
|
35 |
+
<GetActiveCarriers xmlns="http://freightcenter.com/API/V03/">
|
36 |
+
<request>
|
37 |
+
<Username>'.$username.'</Username>
|
38 |
+
<Password>'.$password.'</Password>
|
39 |
+
<LicenseKey>D3217D78-8ACB-4C6A-8C38-A5F5266C9BCE</LicenseKey>
|
40 |
+
</request>
|
41 |
+
</GetActiveCarriers>
|
42 |
+
</soap12:Body>
|
43 |
+
</soap12:Envelope>';
|
44 |
+
$apiurl = 'http://sandbox.freightcenter.com/v03/carriers.asmx?op=GetActiveCarriers';
|
45 |
+
|
46 |
+
$headers = array(
|
47 |
+
"POST /V03/carriers.asmx HTTP/1.1",
|
48 |
+
"Host: sandbox.freightcenter.com",
|
49 |
+
"Content-type: application/soap+xml; charset=utf-8",
|
50 |
+
"Content-length: ".strlen($xml)
|
51 |
+
);
|
52 |
+
|
53 |
+
/* send curl request to get active carriers */
|
54 |
+
$soap_do = curl_init();
|
55 |
+
curl_setopt($soap_do, CURLOPT_URL, $apiurl );
|
56 |
+
curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true );
|
57 |
+
curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false);
|
58 |
+
curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false);
|
59 |
+
curl_setopt($soap_do, CURLOPT_POST, true );
|
60 |
+
curl_setopt($soap_do, CURLOPT_HTTPHEADER, $headers);
|
61 |
+
curl_setopt($soap_do, CURLOPT_POSTFIELDS, $xml);
|
62 |
+
|
63 |
+
$result = curl_exec($soap_do);
|
64 |
+
curl_close($soap_do);
|
65 |
+
|
66 |
+
$get_result = preg_replace('/xmlns:.*\"/','',$result);
|
67 |
+
$get_response = preg_replace('<soap:>','',$get_result);
|
68 |
+
$get_response1 = preg_replace('<</GetActiveCarriersResponse>>','',$get_response);
|
69 |
+
$get_response2 = preg_replace('<</Body>>','',$get_response1);
|
70 |
+
$get_response3 = preg_replace('<</Text></Reason><Detail /></Fault>>','',$get_response2);
|
71 |
+
|
72 |
+
$output = xmlToArray($get_response3);
|
73 |
+
//echo "<pre>";print_r($output);exit;
|
74 |
+
|
75 |
+
if(isset($output[0])) {
|
76 |
+
$session->addError("Please check credentials!");
|
77 |
+
} else {
|
78 |
+
$response_type = $output['GetActiveCarriersResult']['TransactionResponse']['Type'];
|
79 |
+
if($response_type == 'SUCCESS') {
|
80 |
+
//echo "<pre>";print_r($output);
|
81 |
+
$carriers = $output['GetActiveCarriersResult']['Carriers']['Carrier'];
|
82 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
83 |
+
|
84 |
+
$new_carriers = array();
|
85 |
+
foreach($carriers as $carrier) {
|
86 |
+
$carrierid = $carrier['CarrierId'];
|
87 |
+
$carrierscac = $carrier['CarrierSCAC'];
|
88 |
+
$carriercode = $carrier['CarrierCode'];
|
89 |
+
if($carriercode == NULL) {
|
90 |
+
$carriercode = '';
|
91 |
+
}
|
92 |
+
$carriername = $carrier['CarrierName'];
|
93 |
+
|
94 |
+
$new_carriers[] = $carrier['CarrierId'];
|
95 |
+
|
96 |
+
$carrier_query = $connection->query("select * from brst_freight_carriers where username='$username' AND carrierid = $carrierid");
|
97 |
+
$getcarrier = $carrier_query->fetchAll();
|
98 |
+
//echo "<pre>";print_r($getcarrier);exit;
|
99 |
+
if($getcarrier == NULL) {
|
100 |
+
$mysql = "INSERT INTO brst_freight_carriers (username,carrierid,carrier_scac,carrier_code,carrier_name) VALUES ('$username',$carrierid,'$carrierscac','$carriercode','$carriername')";
|
101 |
+
$connection->query($mysql);
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
$getcar_query = $connection->query("select * from brst_freight_carriers where username = '$username'");
|
106 |
+
$getcarriers = $getcar_query->fetchAll();
|
107 |
+
if($getcarriers != NULL) {
|
108 |
+
$all_carriers = array();
|
109 |
+
foreach($getcarriers as $car) {
|
110 |
+
$all_carriers[] = $car['carrierid'];
|
111 |
+
}
|
112 |
+
|
113 |
+
$newresult = array_diff($all_carriers,$new_carriers);
|
114 |
+
if($newresult != NULL) {
|
115 |
+
foreach ($newresult as $nresult) {
|
116 |
+
$mysql1 = "Delete from brst_freight_carriers where carrierid = $nresult AND username = '$username')";
|
117 |
+
$connection->query($mysql1);
|
118 |
+
}
|
119 |
+
}
|
120 |
+
}
|
121 |
+
|
122 |
+
if (isset($_FILES['groups']['name']) && is_array($_FILES['groups']['name'])) {
|
123 |
+
/**
|
124 |
+
* Carefully merge $_FILES and $_POST information
|
125 |
+
* None of '+=' or 'array_merge_recursive' can do this correct
|
126 |
+
*/
|
127 |
+
foreach($_FILES['groups']['name'] as $groupName => $group) {
|
128 |
+
if (is_array($group)) {
|
129 |
+
foreach ($group['fields'] as $fieldName => $field) {
|
130 |
+
if (!empty($field['value'])) {
|
131 |
+
$groups[$groupName]['fields'][$fieldName] = array('value' => $field['value']);
|
132 |
+
}
|
133 |
+
}
|
134 |
+
}
|
135 |
+
}
|
136 |
+
}
|
137 |
+
|
138 |
+
try {
|
139 |
+
if (!$this->_isSectionAllowed($this->getRequest()->getParam('section'))) {
|
140 |
+
throw new Exception(Mage::helper('adminhtml')->__('This section is not allowed.'));
|
141 |
+
}
|
142 |
+
|
143 |
+
// custom save logic
|
144 |
+
$this->_saveSection();
|
145 |
+
$section = $this->getRequest()->getParam('section');
|
146 |
+
$website = $this->getRequest()->getParam('website');
|
147 |
+
$store = $this->getRequest()->getParam('store');
|
148 |
+
Mage::getSingleton('adminhtml/config_data')
|
149 |
+
->setSection($section)
|
150 |
+
->setWebsite($website)
|
151 |
+
->setStore($store)
|
152 |
+
->setGroups($groups)
|
153 |
+
->save();
|
154 |
+
|
155 |
+
// reinit configuration
|
156 |
+
Mage::getConfig()->reinit();
|
157 |
+
Mage::dispatchEvent('admin_system_config_section_save_after', array(
|
158 |
+
'website' => $website,
|
159 |
+
'store' => $store,
|
160 |
+
'section' => $section
|
161 |
+
));
|
162 |
+
Mage::app()->reinitStores();
|
163 |
+
|
164 |
+
// website and store codes can be used in event implementation, so set them as well
|
165 |
+
Mage::dispatchEvent("admin_system_config_changed_section_{$section}",
|
166 |
+
array('website' => $website, 'store' => $store)
|
167 |
+
);
|
168 |
+
$session->addSuccess(Mage::helper('adminhtml')->__('The configuration has been saved.'));
|
169 |
+
}
|
170 |
+
catch (Mage_Core_Exception $e) {
|
171 |
+
foreach(explode("\n", $e->getMessage()) as $message) {
|
172 |
+
$session->addError($message);
|
173 |
+
}
|
174 |
+
}
|
175 |
+
catch (Exception $e) {
|
176 |
+
$session->addException($e,
|
177 |
+
Mage::helper('adminhtml')->__('An error occurred while saving this configuration:') . ' '
|
178 |
+
. $e->getMessage());
|
179 |
+
}
|
180 |
+
|
181 |
+
$this->_saveState($this->getRequest()->getPost('config_state'));
|
182 |
+
|
183 |
+
} else if($response_type == 'ERROR') {
|
184 |
+
$errormsg = $output['GetActiveCarriersResult']['TransactionResponse']['Message'];
|
185 |
+
$session->addError($errormsg);
|
186 |
+
}
|
187 |
+
}
|
188 |
+
|
189 |
+
} else {
|
190 |
+
|
191 |
+
if (isset($_FILES['groups']['name']) && is_array($_FILES['groups']['name'])) {
|
192 |
+
/**
|
193 |
+
* Carefully merge $_FILES and $_POST information
|
194 |
+
* None of '+=' or 'array_merge_recursive' can do this correct
|
195 |
+
*/
|
196 |
+
foreach($_FILES['groups']['name'] as $groupName => $group) {
|
197 |
+
if (is_array($group)) {
|
198 |
+
foreach ($group['fields'] as $fieldName => $field) {
|
199 |
+
if (!empty($field['value'])) {
|
200 |
+
$groups[$groupName]['fields'][$fieldName] = array('value' => $field['value']);
|
201 |
+
}
|
202 |
+
}
|
203 |
+
}
|
204 |
+
}
|
205 |
+
}
|
206 |
+
|
207 |
+
try {
|
208 |
+
if (!$this->_isSectionAllowed($this->getRequest()->getParam('section'))) {
|
209 |
+
throw new Exception(Mage::helper('adminhtml')->__('This section is not allowed.'));
|
210 |
+
}
|
211 |
+
|
212 |
+
// custom save logic
|
213 |
+
$this->_saveSection();
|
214 |
+
$section = $this->getRequest()->getParam('section');
|
215 |
+
$website = $this->getRequest()->getParam('website');
|
216 |
+
$store = $this->getRequest()->getParam('store');
|
217 |
+
Mage::getSingleton('adminhtml/config_data')
|
218 |
+
->setSection($section)
|
219 |
+
->setWebsite($website)
|
220 |
+
->setStore($store)
|
221 |
+
->setGroups($groups)
|
222 |
+
->save();
|
223 |
+
|
224 |
+
// reinit configuration
|
225 |
+
Mage::getConfig()->reinit();
|
226 |
+
Mage::dispatchEvent('admin_system_config_section_save_after', array(
|
227 |
+
'website' => $website,
|
228 |
+
'store' => $store,
|
229 |
+
'section' => $section
|
230 |
+
));
|
231 |
+
Mage::app()->reinitStores();
|
232 |
+
|
233 |
+
// website and store codes can be used in event implementation, so set them as well
|
234 |
+
Mage::dispatchEvent("admin_system_config_changed_section_{$section}",
|
235 |
+
array('website' => $website, 'store' => $store)
|
236 |
+
);
|
237 |
+
$session->addSuccess(Mage::helper('adminhtml')->__('The configuration has been saved.'));
|
238 |
+
}
|
239 |
+
catch (Mage_Core_Exception $e) {
|
240 |
+
foreach(explode("\n", $e->getMessage()) as $message) {
|
241 |
+
$session->addError($message);
|
242 |
+
}
|
243 |
+
}
|
244 |
+
catch (Exception $e) {
|
245 |
+
$session->addException($e,
|
246 |
+
Mage::helper('adminhtml')->__('An error occurred while saving this configuration:') . ' '
|
247 |
+
. $e->getMessage());
|
248 |
+
}
|
249 |
+
|
250 |
+
$this->_saveState($this->getRequest()->getPost('config_state'));
|
251 |
+
}
|
252 |
+
|
253 |
+
$this->_redirect('*/*/edit', array('_current' => array('section', 'website', 'store')));
|
254 |
+
}
|
255 |
+
}
|
256 |
+
|
257 |
+
?>
|
app/code/local/Freightcenter/Ship/etc/config.xml
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Freightcenter_Ship>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Freightcenter_Ship>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<ship>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Freightcenter_Ship</module>
|
14 |
+
<frontName>ship</frontName>
|
15 |
+
</args>
|
16 |
+
</ship>
|
17 |
+
</routers>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<ship>
|
21 |
+
<file>ship.xml</file>
|
22 |
+
</ship>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
</frontend>
|
26 |
+
<global>
|
27 |
+
<models>
|
28 |
+
<ship>
|
29 |
+
<class>Freightcenter_Ship_Model</class>
|
30 |
+
<resourceModel>ship_mysql4</resourceModel>
|
31 |
+
</ship>
|
32 |
+
<ship_mysql4>
|
33 |
+
<class>Freightcenter_Ship_Model_Mysql4</class>
|
34 |
+
<entities>
|
35 |
+
<ship>
|
36 |
+
<table>ship</table>
|
37 |
+
</ship>
|
38 |
+
</entities>
|
39 |
+
</ship_mysql4>
|
40 |
+
</models>
|
41 |
+
<resources>
|
42 |
+
<ship_setup>
|
43 |
+
<setup>
|
44 |
+
<module>Freightcenter_Ship</module>
|
45 |
+
</setup>
|
46 |
+
<connection>
|
47 |
+
<use>core_setup</use>
|
48 |
+
</connection>
|
49 |
+
</ship_setup>
|
50 |
+
<ship_write>
|
51 |
+
<connection>
|
52 |
+
<use>core_write</use>
|
53 |
+
</connection>
|
54 |
+
</ship_write>
|
55 |
+
<ship_read>
|
56 |
+
<connection>
|
57 |
+
<use>core_read</use>
|
58 |
+
</connection>
|
59 |
+
</ship_read>
|
60 |
+
</resources>
|
61 |
+
<blocks>
|
62 |
+
<ship>
|
63 |
+
<class>Freightcenter_Ship_Block</class>
|
64 |
+
</ship>
|
65 |
+
</blocks>
|
66 |
+
<helpers>
|
67 |
+
<ship>
|
68 |
+
<class>Freightcenter_Ship_Helper</class>
|
69 |
+
</ship>
|
70 |
+
</helpers>
|
71 |
+
<rewrite>
|
72 |
+
<Freightcenter_Ship_system_config>
|
73 |
+
<from><![CDATA[#^/admin/system_config/#]]></from>
|
74 |
+
<to>/freightcenter_ship/system_config/</to>
|
75 |
+
</Freightcenter_Ship_system_config>
|
76 |
+
</rewrite>
|
77 |
+
<rewrite>
|
78 |
+
<Freightcenter_Ship_cart>
|
79 |
+
<from><![CDATA[#^/checkout/cart/#]]></from>
|
80 |
+
<to>/freightcenter_ship/cart/</to>
|
81 |
+
</Freightcenter_Ship_cart>
|
82 |
+
</rewrite>
|
83 |
+
</global>
|
84 |
+
<admin>
|
85 |
+
<routers>
|
86 |
+
<freightcenter_ship>
|
87 |
+
<use>admin</use>
|
88 |
+
<args>
|
89 |
+
<module>Freightcenter_Ship</module>
|
90 |
+
<frontName>freightcenter_ship</frontName>
|
91 |
+
</args>
|
92 |
+
</freightcenter_ship>
|
93 |
+
</routers>
|
94 |
+
</admin>
|
95 |
+
<default>
|
96 |
+
<carriers>
|
97 |
+
<freightcenter>
|
98 |
+
<active>1</active>
|
99 |
+
<model>ship/carrier_freightcenter</model>
|
100 |
+
<title>Carrier Title</title>
|
101 |
+
<name>Method Name</name>
|
102 |
+
<price>5.00</price>
|
103 |
+
<specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
|
104 |
+
</freightcenter>
|
105 |
+
</carriers>
|
106 |
+
</default>
|
107 |
+
</config>
|
app/code/local/Freightcenter/Ship/etc/config.xml@new
ADDED
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Freightcenter_Ship>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Freightcenter_Ship>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<ship>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Freightcenter_Ship</module>
|
14 |
+
<frontName>ship</frontName>
|
15 |
+
</args>
|
16 |
+
</ship>
|
17 |
+
</routers>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<ship>
|
21 |
+
<file>ship.xml</file>
|
22 |
+
</ship>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
</frontend>
|
26 |
+
<global>
|
27 |
+
<models>
|
28 |
+
<ship>
|
29 |
+
<rewrite>
|
30 |
+
<carrier_flatrate>Freightcenter_Ship_Model_Carrier_Flatrate</carrier_flatrate>
|
31 |
+
</rewrite>
|
32 |
+
</ship>
|
33 |
+
|
34 |
+
<ship>
|
35 |
+
<class>Freightcenter_Ship_Model</class>
|
36 |
+
<resourceModel>ship_mysql4</resourceModel>
|
37 |
+
|
38 |
+
</ship>
|
39 |
+
<ship_mysql4>
|
40 |
+
<class>Freightcenter_Ship_Model_Mysql4</class>
|
41 |
+
<entities>
|
42 |
+
<ship>
|
43 |
+
<table>ship</table>
|
44 |
+
</ship>
|
45 |
+
</entities>
|
46 |
+
</ship_mysql4>
|
47 |
+
|
48 |
+
</models>
|
49 |
+
<resources>
|
50 |
+
<ship_setup>
|
51 |
+
<setup>
|
52 |
+
<module>Freightcenter_Ship</module>
|
53 |
+
</setup>
|
54 |
+
<connection>
|
55 |
+
<use>core_setup</use>
|
56 |
+
</connection>
|
57 |
+
</ship_setup>
|
58 |
+
<ship_write>
|
59 |
+
<connection>
|
60 |
+
<use>core_write</use>
|
61 |
+
</connection>
|
62 |
+
</ship_write>
|
63 |
+
<ship_read>
|
64 |
+
<connection>
|
65 |
+
<use>core_read</use>
|
66 |
+
</connection>
|
67 |
+
</ship_read>
|
68 |
+
</resources>
|
69 |
+
<blocks>
|
70 |
+
<ship>
|
71 |
+
<class>Freightcenter_Ship_Block</class>
|
72 |
+
</ship>
|
73 |
+
</blocks>
|
74 |
+
<helpers>
|
75 |
+
<ship>
|
76 |
+
<class>Freightcenter_Ship_Helper</class>
|
77 |
+
</ship>
|
78 |
+
</helpers>
|
79 |
+
<rewrite>
|
80 |
+
<Freightcenter_Ship_system_config>
|
81 |
+
<from><![CDATA[#^/admin/system_config/#]]></from>
|
82 |
+
<to>/freightcenter_ship/system_config/</to>
|
83 |
+
</Freightcenter_Ship_system_config>
|
84 |
+
</rewrite>
|
85 |
+
|
86 |
+
<rewrite>
|
87 |
+
<Freightcenter_Ship_cart>
|
88 |
+
<from><![CDATA[#^/checkout/cart/#]]></from>
|
89 |
+
<to>/freightcenter_ship/cart/</to>
|
90 |
+
</Freightcenter_Ship_cart>
|
91 |
+
</rewrite>
|
92 |
+
|
93 |
+
<!-- <rewrite>
|
94 |
+
<Freightcenter_Ship_cart>
|
95 |
+
<from><![CDATA[#^/checkout/cart/#]]></from>
|
96 |
+
<to>/freightcenter_ship/cart/</to>
|
97 |
+
</Freightcenter_Ship_cart>
|
98 |
+
</rewrite> -->
|
99 |
+
|
100 |
+
|
101 |
+
|
102 |
+
</global>
|
103 |
+
<admin>
|
104 |
+
<routers>
|
105 |
+
<freightcenter_ship>
|
106 |
+
<use>admin</use>
|
107 |
+
<args>
|
108 |
+
<module>Freightcenter_Ship</module>
|
109 |
+
<frontName>freightcenter_ship</frontName>
|
110 |
+
</args>
|
111 |
+
</freightcenter_ship>
|
112 |
+
</routers>
|
113 |
+
</admin>
|
114 |
+
<default>
|
115 |
+
<carriers>
|
116 |
+
<freightcenter>
|
117 |
+
<active>1</active>
|
118 |
+
<model>ship/carrier_freightcenter</model>
|
119 |
+
<title>Carrier Title</title>
|
120 |
+
<name>Method Name</name>
|
121 |
+
<price>5.00</price>
|
122 |
+
<specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
|
123 |
+
</freightcenter>
|
124 |
+
</carriers>
|
125 |
+
</default>
|
126 |
+
</config>
|
app/code/local/Freightcenter/Ship/etc/config.xml@old
ADDED
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/afl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Mage
|
23 |
+
* @package Freightcenter_Ship
|
24 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
25 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
26 |
+
*/
|
27 |
+
-->
|
28 |
+
<config>
|
29 |
+
<modules>
|
30 |
+
<Freightcenter_Ship>
|
31 |
+
<version>1.6.0.0</version>
|
32 |
+
</Freightcenter_Ship>
|
33 |
+
</modules>
|
34 |
+
<global>
|
35 |
+
<models>
|
36 |
+
<ship>
|
37 |
+
<class>Freightcenter_Ship_Model</class>
|
38 |
+
<resourceModel>shipping_resource</resourceModel>
|
39 |
+
</ship>
|
40 |
+
<shipping_resource>
|
41 |
+
<class>Freightcenter_Ship_Model_Resource</class>
|
42 |
+
<deprecatedNode>shipping_mysql4</deprecatedNode>
|
43 |
+
<entities>
|
44 |
+
<tablerate>
|
45 |
+
<table>shipping_tablerate</table>
|
46 |
+
</tablerate>
|
47 |
+
</entities>
|
48 |
+
</shipping_resource>
|
49 |
+
</models>
|
50 |
+
<resources>
|
51 |
+
<shipping_setup>
|
52 |
+
<setup>
|
53 |
+
<module>Freightcenter_Ship</module>
|
54 |
+
</setup>
|
55 |
+
</shipping_setup>
|
56 |
+
</resources>
|
57 |
+
<sales>
|
58 |
+
<ship>
|
59 |
+
<rule>
|
60 |
+
<conditions>
|
61 |
+
<dest_country>
|
62 |
+
<class>Mage_Sales_Model_Shipping_Rule_Condition_Dest_Country</class>
|
63 |
+
</dest_country>
|
64 |
+
<dest_region>
|
65 |
+
<class>Mage_Sales_Model_Shipping_Rule_Condition_Dest_Region</class>
|
66 |
+
</dest_region>
|
67 |
+
<dest_zip>
|
68 |
+
<class>Mage_Sales_Model_Shipping_Rule_Condition_Dest_Zip</class>
|
69 |
+
</dest_zip>
|
70 |
+
<package_weight>
|
71 |
+
<class>Mage_Sales_Model_Shipping_Rule_Condition_Package_Weight</class>
|
72 |
+
</package_weight>
|
73 |
+
<order_subtotal>
|
74 |
+
<class>Mage_Sales_Model_Shipping_Rule_Condition_Order_Subtotal</class>
|
75 |
+
</order_subtotal>
|
76 |
+
<order_totalqty>
|
77 |
+
<class>Mage_Sales_Model_Shipping_Rule_Condition_Order_Totalqty</class>
|
78 |
+
</order_totalqty>
|
79 |
+
</conditions>
|
80 |
+
<actions>
|
81 |
+
<carrier>
|
82 |
+
<class>Mage_Sales_Model_Shipping_Rule_Action_Carrier</class>
|
83 |
+
</carrier>
|
84 |
+
<method>
|
85 |
+
<class>Mage_Sales_Model_Shipping_Rule_Action_Method</class>
|
86 |
+
</method>
|
87 |
+
</actions>
|
88 |
+
</rule>
|
89 |
+
</ship>
|
90 |
+
</sales>
|
91 |
+
</global>
|
92 |
+
<adminhtml>
|
93 |
+
<translate>
|
94 |
+
<modules>
|
95 |
+
<Freightcenter_Ship>
|
96 |
+
<files>
|
97 |
+
<default>Freightcenter_Ship.csv</default>
|
98 |
+
</files>
|
99 |
+
</Freightcenter_Ship>
|
100 |
+
</modules>
|
101 |
+
</translate>
|
102 |
+
</adminhtml>
|
103 |
+
<frontend>
|
104 |
+
<translate>
|
105 |
+
<modules>
|
106 |
+
<Freightcenter_Ship>
|
107 |
+
<files>
|
108 |
+
<default>Freightcenter_Ship.csv</default>
|
109 |
+
</files>
|
110 |
+
</Freightcenter_Ship>
|
111 |
+
</modules>
|
112 |
+
</translate>
|
113 |
+
<routers>
|
114 |
+
<ship>
|
115 |
+
<use>standard</use>
|
116 |
+
<args>
|
117 |
+
<module>Freightcenter_Ship</module>
|
118 |
+
<frontName>ship</frontName>
|
119 |
+
</args>
|
120 |
+
</ship>
|
121 |
+
</routers>
|
122 |
+
<layout>
|
123 |
+
<updates>
|
124 |
+
<ship>
|
125 |
+
<file>ship.xml</file>
|
126 |
+
</ship>
|
127 |
+
</updates>
|
128 |
+
</layout>
|
129 |
+
</frontend>
|
130 |
+
<default>
|
131 |
+
<ship>
|
132 |
+
<option>
|
133 |
+
<checkout_multiple>1</checkout_multiple>
|
134 |
+
<checkout_multiple_maximum_qty>100</checkout_multiple_maximum_qty>
|
135 |
+
</option>
|
136 |
+
<origin>
|
137 |
+
<country_id>US</country_id>
|
138 |
+
<postcode>90034</postcode>
|
139 |
+
<region_id>12</region_id>
|
140 |
+
</origin>
|
141 |
+
</ship>
|
142 |
+
<carriers>
|
143 |
+
<flatrate>
|
144 |
+
<active>1</active>
|
145 |
+
<sallowspecific>0</sallowspecific>
|
146 |
+
<model>ship/carrier_flatrate</model>
|
147 |
+
<name>Fixed</name>
|
148 |
+
<price>5.00</price>
|
149 |
+
<title>Flat Rate</title>
|
150 |
+
<type>I</type>
|
151 |
+
<specificerrmsg>This ship method is currently unavailable. If you would like to ship using this ship method, please contact us.</specificerrmsg>
|
152 |
+
<handling_type>F</handling_type>
|
153 |
+
</flatrate>
|
154 |
+
<freeshipping>
|
155 |
+
<active>0</active>
|
156 |
+
<sallowspecific>0</sallowspecific>
|
157 |
+
<cutoff_cost>50</cutoff_cost>
|
158 |
+
<model>ship/carrier_freeshipping</model>
|
159 |
+
<name>Free</name>
|
160 |
+
<title>Free ship</title>
|
161 |
+
<specificerrmsg>This ship method is currently unavailable. If you would like to ship using this ship method, please contact us.</specificerrmsg>
|
162 |
+
</freeshipping>
|
163 |
+
<tablerate>
|
164 |
+
<active>0</active>
|
165 |
+
<sallowspecific>0</sallowspecific>
|
166 |
+
<condition_name>package_weight</condition_name>
|
167 |
+
<include_virtual_price>1</include_virtual_price>
|
168 |
+
<model>ship/carrier_tablerate</model>
|
169 |
+
<name>Table Rate</name>
|
170 |
+
<title>Best Way</title>
|
171 |
+
<specificerrmsg>This ship method is currently unavailable. If you would like to ship using this ship method, please contact us.</specificerrmsg>
|
172 |
+
<handling_type>F</handling_type>
|
173 |
+
</tablerate>
|
174 |
+
</carriers>
|
175 |
+
</default>
|
176 |
+
</config>
|
app/code/local/Freightcenter/Ship/etc/system.xml
ADDED
@@ -0,0 +1,237 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<carriers>
|
5 |
+
<groups>
|
6 |
+
<freightcenter translate="label" module="ship">
|
7 |
+
<label>FreightCenter Shipping Module</label>
|
8 |
+
<frontend_type>text</frontend_type>
|
9 |
+
<sort_order>99</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 |
+
<active translate="label">
|
15 |
+
<label>Enabled</label>
|
16 |
+
<frontend_type>select</frontend_type>
|
17 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
18 |
+
<sort_order>1</sort_order>
|
19 |
+
<show_in_default>1</show_in_default>
|
20 |
+
<show_in_website>1</show_in_website>
|
21 |
+
<show_in_store>1</show_in_store>
|
22 |
+
</active>
|
23 |
+
<freightuser translate="label">
|
24 |
+
<label>Username</label>
|
25 |
+
<frontend_type>text</frontend_type>
|
26 |
+
<sort_order>2</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 |
+
</freightuser>
|
31 |
+
<freightpwd translate="label">
|
32 |
+
<label>Password</label>
|
33 |
+
<frontend_type>password</frontend_type>
|
34 |
+
<sort_order>3</sort_order>
|
35 |
+
<show_in_default>1</show_in_default>
|
36 |
+
<show_in_website>1</show_in_website>
|
37 |
+
<show_in_store>1</show_in_store>
|
38 |
+
</freightpwd>
|
39 |
+
<!-- <freightlicensekey translate="label">
|
40 |
+
<label>License Key</label>
|
41 |
+
<frontend_type>text</frontend_type>
|
42 |
+
<sort_order>4</sort_order>
|
43 |
+
<show_in_default>1</show_in_default>
|
44 |
+
<show_in_website>1</show_in_website>
|
45 |
+
<show_in_store>1</show_in_store>
|
46 |
+
</freightlicensekey>-->
|
47 |
+
<name translate="label">
|
48 |
+
<label>Method Name</label>
|
49 |
+
<frontend_type>text</frontend_type>
|
50 |
+
<sort_order>5</sort_order>
|
51 |
+
<show_in_default>1</show_in_default>
|
52 |
+
<show_in_website>1</show_in_website>
|
53 |
+
<show_in_store>1</show_in_store>
|
54 |
+
</name>
|
55 |
+
<!-- <apirateurl translate="label">
|
56 |
+
<label>ApiRates</label>
|
57 |
+
<frontend_type>text</frontend_type>
|
58 |
+
<sort_order>5</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 |
+
<comment>Default Api Url is: api.freightcenter.com/v04/rates.asmx </comment>
|
63 |
+
</apirateurl> -->
|
64 |
+
<!-- <apishipmenturl translate="label">
|
65 |
+
<label>Api Shipments</label>
|
66 |
+
<frontend_type>text</frontend_type>
|
67 |
+
<sort_order>5</sort_order>
|
68 |
+
<show_in_default>1</show_in_default>
|
69 |
+
<show_in_website>1</show_in_website>
|
70 |
+
<show_in_store>1</show_in_store>
|
71 |
+
<comment>Default Api Url is: api.freightcenter.com/v04/shipments.asmx </comment>
|
72 |
+
</apishipmenturl> -->
|
73 |
+
<!-- <apicarriersurl translate="label">
|
74 |
+
<label>Api Carriers</label>
|
75 |
+
<frontend_type>text</frontend_type>
|
76 |
+
<sort_order>5</sort_order>
|
77 |
+
<show_in_default>1</show_in_default>
|
78 |
+
<show_in_website>1</show_in_website>
|
79 |
+
<show_in_store>1</show_in_store>
|
80 |
+
<comment>Default Api Url is: api.freightcenter.com/v04/carriers.asmx</comment>
|
81 |
+
</apicarriersurl> -->
|
82 |
+
<sandbox translate="label">
|
83 |
+
<label>Mode</label>
|
84 |
+
<frontend_type>select</frontend_type>
|
85 |
+
<source_model>ship/sand</source_model>
|
86 |
+
<sort_order>1</sort_order>
|
87 |
+
<show_in_default>1</show_in_default>
|
88 |
+
<show_in_website>1</show_in_website>
|
89 |
+
<show_in_store>1</show_in_store>
|
90 |
+
</sandbox>
|
91 |
+
<title translate="label">
|
92 |
+
<label>Title</label>
|
93 |
+
<frontend_type>text</frontend_type>
|
94 |
+
<sort_order>6</sort_order>
|
95 |
+
<show_in_default>1</show_in_default>
|
96 |
+
<show_in_website>1</show_in_website>
|
97 |
+
<show_in_store>1</show_in_store>
|
98 |
+
</title>
|
99 |
+
|
100 |
+
|
101 |
+
|
102 |
+
|
103 |
+
<discount_price translate="label">
|
104 |
+
<label>Discounted Shipping price (Dollar Amount)</label>
|
105 |
+
<frontend_type>text</frontend_type>
|
106 |
+
<sort_order>7</sort_order>
|
107 |
+
<show_in_default>1</show_in_default>
|
108 |
+
<show_in_website>1</show_in_website>
|
109 |
+
<show_in_store>1</show_in_store>
|
110 |
+
<comment>Only Numerical Value Entered</comment>
|
111 |
+
</discount_price>
|
112 |
+
<discount translate="label">
|
113 |
+
<label>Discounted Shipping After Minimum Order Amount</label>
|
114 |
+
<frontend_type>select</frontend_type>
|
115 |
+
<source_model>ship/Discount</source_model>
|
116 |
+
<sort_order>7</sort_order>
|
117 |
+
<show_in_default>1</show_in_default>
|
118 |
+
<show_in_website>1</show_in_website>
|
119 |
+
<show_in_store>1</show_in_store>
|
120 |
+
|
121 |
+
</discount>
|
122 |
+
<discount_amount translate="label">
|
123 |
+
<label>Minimum Amount for Discounted Shipping</label>
|
124 |
+
<frontend_type>text</frontend_type>
|
125 |
+
<sort_order>7</sort_order>
|
126 |
+
<show_in_default>1</show_in_default>
|
127 |
+
<show_in_website>1</show_in_website>
|
128 |
+
<show_in_store>1</show_in_store>
|
129 |
+
<comment>Only Numerical Value Entered</comment>
|
130 |
+
</discount_amount>
|
131 |
+
|
132 |
+
<markup_type translate="label">
|
133 |
+
<label>Markup/Discount Type</label>
|
134 |
+
<frontend_type>select</frontend_type>
|
135 |
+
<source_model>ship/types</source_model>
|
136 |
+
<sort_order>8</sort_order>
|
137 |
+
<show_in_default>1</show_in_default>
|
138 |
+
<show_in_website>1</show_in_website>
|
139 |
+
<show_in_store>1</show_in_store>
|
140 |
+
|
141 |
+
</markup_type>
|
142 |
+
|
143 |
+
|
144 |
+
<markup_price translate="label">
|
145 |
+
<label>Markup/Discount Amount</label>
|
146 |
+
<frontend_type>text</frontend_type>
|
147 |
+
<sort_order>8</sort_order>
|
148 |
+
<show_in_default>1</show_in_default>
|
149 |
+
<show_in_website>1</show_in_website>
|
150 |
+
<show_in_store>1</show_in_store>
|
151 |
+
<comment>Only Numerical Value Entered</comment>
|
152 |
+
</markup_price>
|
153 |
+
|
154 |
+
<markup translate="label">
|
155 |
+
<label>Markup/Discount Mode</label>
|
156 |
+
<frontend_type>select</frontend_type>
|
157 |
+
<show_in_default>1</show_in_default>
|
158 |
+
<source_model>ship/mark</source_model>
|
159 |
+
<sort_order>8</sort_order>
|
160 |
+
<show_in_website>1</show_in_website>
|
161 |
+
<show_in_store>1</show_in_store>
|
162 |
+
</markup>
|
163 |
+
|
164 |
+
|
165 |
+
|
166 |
+
|
167 |
+
<dest_loctype translate="label">
|
168 |
+
<label>Destination Location Type</label>
|
169 |
+
<frontend_model>ship/adminhtml_system_config_destloctype</frontend_model>
|
170 |
+
<sort_order>9</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 |
+
</dest_loctype>
|
175 |
+
|
176 |
+
|
177 |
+
|
178 |
+
<positions translate="label">
|
179 |
+
<label>Carrier List</label>
|
180 |
+
<frontend_model>ship/adminhtml_system_config_positions</frontend_model>
|
181 |
+
<sort_order>10</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 |
+
</positions>
|
186 |
+
<carrier_display translate="label">
|
187 |
+
<label>Number of Carriers to Display per Shipment</label>
|
188 |
+
<frontend_type>select</frontend_type>
|
189 |
+
<frontend_model>ship/adminhtml_system_config_cdisplay</frontend_model>
|
190 |
+
<sort_order>11</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 |
+
</carrier_display>
|
195 |
+
<breakout_lineitems translate="label">
|
196 |
+
<label>Freight Charge Display Mode</label>
|
197 |
+
<frontend_type>select</frontend_type>
|
198 |
+
<source_model>ship/mode</source_model>
|
199 |
+
<sort_order>12</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 |
+
</breakout_lineitems>
|
204 |
+
<!-- <specificerrmsg translate="label">
|
205 |
+
<label>Displayed Error Message</label>
|
206 |
+
<frontend_type>textarea</frontend_type>
|
207 |
+
<sort_order>7</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 |
+
</specificerrmsg>-->
|
212 |
+
<sallowspecific translate="label">
|
213 |
+
<label>Ship to Applicable Countries</label>
|
214 |
+
<frontend_type>select</frontend_type>
|
215 |
+
<sort_order>90</sort_order>
|
216 |
+
<frontend_class>shipping-applicable-country</frontend_class>
|
217 |
+
<source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
|
218 |
+
<show_in_default>1</show_in_default>
|
219 |
+
<show_in_website>1</show_in_website>
|
220 |
+
<show_in_store>0</show_in_store>
|
221 |
+
</sallowspecific>
|
222 |
+
<specificcountry translate="label">
|
223 |
+
<label>Ship to Specific Countries</label>
|
224 |
+
<frontend_type>multiselect</frontend_type>
|
225 |
+
<sort_order>91</sort_order>
|
226 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
227 |
+
<show_in_default>1</show_in_default>
|
228 |
+
<show_in_website>1</show_in_website>
|
229 |
+
<show_in_store>0</show_in_store>
|
230 |
+
<can_be_empty>1</can_be_empty>
|
231 |
+
</specificcountry>
|
232 |
+
</fields>
|
233 |
+
</freightcenter>
|
234 |
+
</groups>
|
235 |
+
</carriers>
|
236 |
+
</sections>
|
237 |
+
</config>
|
app/code/local/Freightcenter/Ship/etc/system.xml@18July
ADDED
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<carriers>
|
5 |
+
<groups>
|
6 |
+
<freightcenter translate="label" module="ship">
|
7 |
+
<label>FreightCenter Shipping Module</label>
|
8 |
+
<frontend_type>text</frontend_type>
|
9 |
+
<sort_order>99</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 |
+
<active translate="label">
|
15 |
+
<label>Enabled</label>
|
16 |
+
<frontend_type>select</frontend_type>
|
17 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
18 |
+
<sort_order>1</sort_order>
|
19 |
+
<show_in_default>1</show_in_default>
|
20 |
+
<show_in_website>1</show_in_website>
|
21 |
+
<show_in_store>1</show_in_store>
|
22 |
+
</active>
|
23 |
+
<freightuser translate="label">
|
24 |
+
<label>Username</label>
|
25 |
+
<frontend_type>text</frontend_type>
|
26 |
+
<sort_order>2</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 |
+
</freightuser>
|
31 |
+
<freightpwd translate="label">
|
32 |
+
<label>Password</label>
|
33 |
+
<frontend_type>password</frontend_type>
|
34 |
+
<sort_order>3</sort_order>
|
35 |
+
<show_in_default>1</show_in_default>
|
36 |
+
<show_in_website>1</show_in_website>
|
37 |
+
<show_in_store>1</show_in_store>
|
38 |
+
</freightpwd>
|
39 |
+
<!-- <freightlicensekey translate="label">
|
40 |
+
<label>License Key</label>
|
41 |
+
<frontend_type>text</frontend_type>
|
42 |
+
<sort_order>4</sort_order>
|
43 |
+
<show_in_default>1</show_in_default>
|
44 |
+
<show_in_website>1</show_in_website>
|
45 |
+
<show_in_store>1</show_in_store>
|
46 |
+
</freightlicensekey>-->
|
47 |
+
<name translate="label">
|
48 |
+
<label>Method Name</label>
|
49 |
+
<frontend_type>text</frontend_type>
|
50 |
+
<sort_order>5</sort_order>
|
51 |
+
<show_in_default>1</show_in_default>
|
52 |
+
<show_in_website>1</show_in_website>
|
53 |
+
<show_in_store>1</show_in_store>
|
54 |
+
</name>
|
55 |
+
<url translate="label">
|
56 |
+
<label>Api GetRate Url</label>
|
57 |
+
<frontend_type>text</frontend_type>
|
58 |
+
<sort_order>5</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 |
+
<comment>Default Api Url is: http://api.freightcenter.com/V04/rates.asmx </comment>
|
63 |
+
</url>
|
64 |
+
<sandbox translate="label">
|
65 |
+
<label>Sandbox</label>
|
66 |
+
<frontend_type>select</frontend_type>
|
67 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
68 |
+
<sort_order>1</sort_order>
|
69 |
+
<show_in_default>1</show_in_default>
|
70 |
+
<show_in_website>1</show_in_website>
|
71 |
+
<show_in_store>1</show_in_store>
|
72 |
+
</sandbox>
|
73 |
+
<title translate="label">
|
74 |
+
<label>Title</label>
|
75 |
+
<frontend_type>text</frontend_type>
|
76 |
+
<sort_order>6</sort_order>
|
77 |
+
<show_in_default>1</show_in_default>
|
78 |
+
<show_in_website>1</show_in_website>
|
79 |
+
<show_in_store>1</show_in_store>
|
80 |
+
</title>
|
81 |
+
<dest_loctype translate="label">
|
82 |
+
<label>Destination Location Type</label>
|
83 |
+
<frontend_model>ship/adminhtml_system_config_destloctype</frontend_model>
|
84 |
+
<sort_order>7</sort_order>
|
85 |
+
<show_in_default>1</show_in_default>
|
86 |
+
<show_in_website>1</show_in_website>
|
87 |
+
<show_in_store>1</show_in_store>
|
88 |
+
</dest_loctype>
|
89 |
+
<markup translate="label">
|
90 |
+
<label>Markup/Discount Mode</label>
|
91 |
+
<frontend_type>select</frontend_type>
|
92 |
+
<show_in_default>1</show_in_default>
|
93 |
+
<source_model>ship/mark</source_model>
|
94 |
+
<sort_order>8</sort_order>
|
95 |
+
<show_in_website>1</show_in_website>
|
96 |
+
<show_in_store>1</show_in_store>
|
97 |
+
</markup>
|
98 |
+
<markup_type translate="label">
|
99 |
+
<label>Markup Type</label>
|
100 |
+
<frontend_type>select</frontend_type>
|
101 |
+
<source_model>ship/types</source_model>
|
102 |
+
<sort_order>8</sort_order>
|
103 |
+
<show_in_default>1</show_in_default>
|
104 |
+
<show_in_website>1</show_in_website>
|
105 |
+
<show_in_store>1</show_in_store>
|
106 |
+
|
107 |
+
</markup_type>
|
108 |
+
<markup_price translate="label">
|
109 |
+
<label>Markup Amount</label>
|
110 |
+
<frontend_type>text</frontend_type>
|
111 |
+
<sort_order>9</sort_order>
|
112 |
+
<show_in_default>1</show_in_default>
|
113 |
+
<show_in_website>1</show_in_website>
|
114 |
+
<show_in_store>1</show_in_store>
|
115 |
+
<comment>Only Numerical Value Entered</comment>
|
116 |
+
</markup_price>
|
117 |
+
<positions translate="label">
|
118 |
+
<label>Carrier List</label>
|
119 |
+
<frontend_model>ship/adminhtml_system_config_positions</frontend_model>
|
120 |
+
<sort_order>10</sort_order>
|
121 |
+
<show_in_default>1</show_in_default>
|
122 |
+
<show_in_website>1</show_in_website>
|
123 |
+
<show_in_store>1</show_in_store>
|
124 |
+
</positions>
|
125 |
+
<carrier_display translate="label">
|
126 |
+
<label>Carriers to Display</label>
|
127 |
+
<frontend_type>select</frontend_type>
|
128 |
+
<frontend_model>ship/adminhtml_system_config_cdisplay</frontend_model>
|
129 |
+
<sort_order>11</sort_order>
|
130 |
+
<show_in_default>1</show_in_default>
|
131 |
+
<show_in_website>1</show_in_website>
|
132 |
+
<show_in_store>1</show_in_store>
|
133 |
+
</carrier_display>
|
134 |
+
<breakout_lineitems translate="label">
|
135 |
+
<label>Breakout Line Items</label>
|
136 |
+
<frontend_type>select</frontend_type>
|
137 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
138 |
+
<sort_order>12</sort_order>
|
139 |
+
<show_in_default>1</show_in_default>
|
140 |
+
<show_in_website>1</show_in_website>
|
141 |
+
<show_in_store>1</show_in_store>
|
142 |
+
</breakout_lineitems>
|
143 |
+
<!-- <specificerrmsg translate="label">
|
144 |
+
<label>Displayed Error Message</label>
|
145 |
+
<frontend_type>textarea</frontend_type>
|
146 |
+
<sort_order>7</sort_order>
|
147 |
+
<show_in_default>1</show_in_default>
|
148 |
+
<show_in_website>1</show_in_website>
|
149 |
+
<show_in_store>1</show_in_store>
|
150 |
+
</specificerrmsg>-->
|
151 |
+
<sallowspecific translate="label">
|
152 |
+
<label>Ship to Applicable Countries</label>
|
153 |
+
<frontend_type>select</frontend_type>
|
154 |
+
<sort_order>90</sort_order>
|
155 |
+
<frontend_class>shipping-applicable-country</frontend_class>
|
156 |
+
<source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
|
157 |
+
<show_in_default>1</show_in_default>
|
158 |
+
<show_in_website>1</show_in_website>
|
159 |
+
<show_in_store>0</show_in_store>
|
160 |
+
</sallowspecific>
|
161 |
+
<specificcountry translate="label">
|
162 |
+
<label>Ship to Specific Countries</label>
|
163 |
+
<frontend_type>multiselect</frontend_type>
|
164 |
+
<sort_order>91</sort_order>
|
165 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
166 |
+
<show_in_default>1</show_in_default>
|
167 |
+
<show_in_website>1</show_in_website>
|
168 |
+
<show_in_store>0</show_in_store>
|
169 |
+
<can_be_empty>1</can_be_empty>
|
170 |
+
</specificcountry>
|
171 |
+
</fields>
|
172 |
+
</freightcenter>
|
173 |
+
</groups>
|
174 |
+
</carriers>
|
175 |
+
</sections>
|
176 |
+
</config>
|
app/code/local/Freightcenter/Ship/etc/system.xml@1Aug
ADDED
@@ -0,0 +1,232 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<carriers>
|
5 |
+
<groups>
|
6 |
+
<freightcenter translate="label" module="ship">
|
7 |
+
<label>FreightCenter Shipping Module</label>
|
8 |
+
<frontend_type>text</frontend_type>
|
9 |
+
<sort_order>99</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 |
+
<active translate="label">
|
15 |
+
<label>Enabled</label>
|
16 |
+
<frontend_type>select</frontend_type>
|
17 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
18 |
+
<sort_order>1</sort_order>
|
19 |
+
<show_in_default>1</show_in_default>
|
20 |
+
<show_in_website>1</show_in_website>
|
21 |
+
<show_in_store>1</show_in_store>
|
22 |
+
</active>
|
23 |
+
<freightuser translate="label">
|
24 |
+
<label>Username</label>
|
25 |
+
<frontend_type>text</frontend_type>
|
26 |
+
<sort_order>2</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 |
+
</freightuser>
|
31 |
+
<freightpwd translate="label">
|
32 |
+
<label>Password</label>
|
33 |
+
<frontend_type>password</frontend_type>
|
34 |
+
<sort_order>3</sort_order>
|
35 |
+
<show_in_default>1</show_in_default>
|
36 |
+
<show_in_website>1</show_in_website>
|
37 |
+
<show_in_store>1</show_in_store>
|
38 |
+
</freightpwd>
|
39 |
+
<!-- <freightlicensekey translate="label">
|
40 |
+
<label>License Key</label>
|
41 |
+
<frontend_type>text</frontend_type>
|
42 |
+
<sort_order>4</sort_order>
|
43 |
+
<show_in_default>1</show_in_default>
|
44 |
+
<show_in_website>1</show_in_website>
|
45 |
+
<show_in_store>1</show_in_store>
|
46 |
+
</freightlicensekey>-->
|
47 |
+
<name translate="label">
|
48 |
+
<label>Method Name</label>
|
49 |
+
<frontend_type>text</frontend_type>
|
50 |
+
<sort_order>5</sort_order>
|
51 |
+
<show_in_default>1</show_in_default>
|
52 |
+
<show_in_website>1</show_in_website>
|
53 |
+
<show_in_store>1</show_in_store>
|
54 |
+
</name>
|
55 |
+
<apirateurl translate="label">
|
56 |
+
<label>ApiRates</label>
|
57 |
+
<frontend_type>text</frontend_type>
|
58 |
+
<sort_order>5</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 |
+
<comment>Default Api Url is: api.freightcenter.com/v04/rates.asmx </comment>
|
63 |
+
</apirateurl>
|
64 |
+
<apishipmenturl translate="label">
|
65 |
+
<label>Api Shipments</label>
|
66 |
+
<frontend_type>text</frontend_type>
|
67 |
+
<sort_order>5</sort_order>
|
68 |
+
<show_in_default>1</show_in_default>
|
69 |
+
<show_in_website>1</show_in_website>
|
70 |
+
<show_in_store>1</show_in_store>
|
71 |
+
<comment>Default Api Url is: api.freightcenter.com/v04/shipments.asmx </comment>
|
72 |
+
</apishipmenturl>
|
73 |
+
<apicarriersurl translate="label">
|
74 |
+
<label>Api Carriers</label>
|
75 |
+
<frontend_type>text</frontend_type>
|
76 |
+
<sort_order>5</sort_order>
|
77 |
+
<show_in_default>1</show_in_default>
|
78 |
+
<show_in_website>1</show_in_website>
|
79 |
+
<show_in_store>1</show_in_store>
|
80 |
+
<comment>Default Api Url is: api.freightcenter.com/v04/carriers.asmx</comment>
|
81 |
+
</apicarriersurl>
|
82 |
+
<sandbox translate="label">
|
83 |
+
<label>Mode</label>
|
84 |
+
<frontend_type>select</frontend_type>
|
85 |
+
<source_model>ship/sand</source_model>
|
86 |
+
<sort_order>1</sort_order>
|
87 |
+
<show_in_default>1</show_in_default>
|
88 |
+
<show_in_website>1</show_in_website>
|
89 |
+
<show_in_store>1</show_in_store>
|
90 |
+
</sandbox>
|
91 |
+
<title translate="label">
|
92 |
+
<label>Title</label>
|
93 |
+
<frontend_type>text</frontend_type>
|
94 |
+
<sort_order>6</sort_order>
|
95 |
+
<show_in_default>1</show_in_default>
|
96 |
+
<show_in_website>1</show_in_website>
|
97 |
+
<show_in_store>1</show_in_store>
|
98 |
+
</title>
|
99 |
+
|
100 |
+
|
101 |
+
|
102 |
+
|
103 |
+
<discount_price translate="label">
|
104 |
+
<label>Discounted Shipping price (Dollar Amount)</label>
|
105 |
+
<frontend_type>text</frontend_type>
|
106 |
+
<sort_order>7</sort_order>
|
107 |
+
<show_in_default>1</show_in_default>
|
108 |
+
<show_in_website>1</show_in_website>
|
109 |
+
<show_in_store>1</show_in_store>
|
110 |
+
<comment>Only Numerical Value Entered</comment>
|
111 |
+
</discount_price>
|
112 |
+
<discount_amount translate="label">
|
113 |
+
<label>Minimum Amount for Discounted Shipping</label>
|
114 |
+
<frontend_type>text</frontend_type>
|
115 |
+
<sort_order>7</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>Only Numerical Value Entered</comment>
|
120 |
+
</discount_amount>
|
121 |
+
<discount translate="label">
|
122 |
+
<label>Discounted Shipping After Minimum Order Amount</label>
|
123 |
+
<frontend_type>select</frontend_type>
|
124 |
+
<source_model>ship/Discount</source_model>
|
125 |
+
<sort_order>7</sort_order>
|
126 |
+
<show_in_default>1</show_in_default>
|
127 |
+
<show_in_website>1</show_in_website>
|
128 |
+
<show_in_store>1</show_in_store>
|
129 |
+
|
130 |
+
</discount>
|
131 |
+
<dest_loctype translate="label">
|
132 |
+
<label>Destination Location Type</label>
|
133 |
+
<frontend_model>ship/adminhtml_system_config_destloctype</frontend_model>
|
134 |
+
<sort_order>8</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 |
+
</dest_loctype>
|
139 |
+
<markup translate="label">
|
140 |
+
<label>Markup/Discount Mode</label>
|
141 |
+
<frontend_type>select</frontend_type>
|
142 |
+
<show_in_default>1</show_in_default>
|
143 |
+
<source_model>ship/mark</source_model>
|
144 |
+
<sort_order>8</sort_order>
|
145 |
+
<show_in_website>1</show_in_website>
|
146 |
+
<show_in_store>1</show_in_store>
|
147 |
+
</markup>
|
148 |
+
<markup_type translate="label">
|
149 |
+
<label>Markup Type</label>
|
150 |
+
<frontend_type>select</frontend_type>
|
151 |
+
<source_model>ship/types</source_model>
|
152 |
+
<sort_order>8</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 |
+
|
157 |
+
</markup_type>
|
158 |
+
<markup_price translate="label">
|
159 |
+
<label>Markup Amount</label>
|
160 |
+
<frontend_type>text</frontend_type>
|
161 |
+
<sort_order>9</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 |
+
<comment>Only Numerical Value Entered</comment>
|
166 |
+
</markup_price>
|
167 |
+
|
168 |
+
|
169 |
+
|
170 |
+
|
171 |
+
|
172 |
+
|
173 |
+
<positions translate="label">
|
174 |
+
<label>Carrier List</label>
|
175 |
+
<frontend_model>ship/adminhtml_system_config_positions</frontend_model>
|
176 |
+
<sort_order>10</sort_order>
|
177 |
+
<show_in_default>1</show_in_default>
|
178 |
+
<show_in_website>1</show_in_website>
|
179 |
+
<show_in_store>1</show_in_store>
|
180 |
+
</positions>
|
181 |
+
<carrier_display translate="label">
|
182 |
+
<label>Number of Carriers to Display per Shipment</label>
|
183 |
+
<frontend_type>select</frontend_type>
|
184 |
+
<frontend_model>ship/adminhtml_system_config_cdisplay</frontend_model>
|
185 |
+
<sort_order>11</sort_order>
|
186 |
+
<show_in_default>1</show_in_default>
|
187 |
+
<show_in_website>1</show_in_website>
|
188 |
+
<show_in_store>1</show_in_store>
|
189 |
+
</carrier_display>
|
190 |
+
<breakout_lineitems translate="label">
|
191 |
+
<label>Freight Charge Display Mode</label>
|
192 |
+
<frontend_type>select</frontend_type>
|
193 |
+
<source_model>ship/mode</source_model>
|
194 |
+
<sort_order>12</sort_order>
|
195 |
+
<show_in_default>1</show_in_default>
|
196 |
+
<show_in_website>1</show_in_website>
|
197 |
+
<show_in_store>1</show_in_store>
|
198 |
+
</breakout_lineitems>
|
199 |
+
<!-- <specificerrmsg translate="label">
|
200 |
+
<label>Displayed Error Message</label>
|
201 |
+
<frontend_type>textarea</frontend_type>
|
202 |
+
<sort_order>7</sort_order>
|
203 |
+
<show_in_default>1</show_in_default>
|
204 |
+
<show_in_website>1</show_in_website>
|
205 |
+
<show_in_store>1</show_in_store>
|
206 |
+
</specificerrmsg>-->
|
207 |
+
<sallowspecific translate="label">
|
208 |
+
<label>Ship to Applicable Countries</label>
|
209 |
+
<frontend_type>select</frontend_type>
|
210 |
+
<sort_order>90</sort_order>
|
211 |
+
<frontend_class>shipping-applicable-country</frontend_class>
|
212 |
+
<source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
|
213 |
+
<show_in_default>1</show_in_default>
|
214 |
+
<show_in_website>1</show_in_website>
|
215 |
+
<show_in_store>0</show_in_store>
|
216 |
+
</sallowspecific>
|
217 |
+
<specificcountry translate="label">
|
218 |
+
<label>Ship to Specific Countries</label>
|
219 |
+
<frontend_type>multiselect</frontend_type>
|
220 |
+
<sort_order>91</sort_order>
|
221 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
222 |
+
<show_in_default>1</show_in_default>
|
223 |
+
<show_in_website>1</show_in_website>
|
224 |
+
<show_in_store>0</show_in_store>
|
225 |
+
<can_be_empty>1</can_be_empty>
|
226 |
+
</specificcountry>
|
227 |
+
</fields>
|
228 |
+
</freightcenter>
|
229 |
+
</groups>
|
230 |
+
</carriers>
|
231 |
+
</sections>
|
232 |
+
</config>
|
app/code/local/Freightcenter/Ship/etc/system.xml@24July
ADDED
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<carriers>
|
5 |
+
<groups>
|
6 |
+
<freightcenter translate="label" module="ship">
|
7 |
+
<label>FreightCenter Shipping Module</label>
|
8 |
+
<frontend_type>text</frontend_type>
|
9 |
+
<sort_order>99</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 |
+
<active translate="label">
|
15 |
+
<label>Enabled</label>
|
16 |
+
<frontend_type>select</frontend_type>
|
17 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
18 |
+
<sort_order>1</sort_order>
|
19 |
+
<show_in_default>1</show_in_default>
|
20 |
+
<show_in_website>1</show_in_website>
|
21 |
+
<show_in_store>1</show_in_store>
|
22 |
+
</active>
|
23 |
+
<freightuser translate="label">
|
24 |
+
<label>Username</label>
|
25 |
+
<frontend_type>text</frontend_type>
|
26 |
+
<sort_order>2</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 |
+
</freightuser>
|
31 |
+
<freightpwd translate="label">
|
32 |
+
<label>Password</label>
|
33 |
+
<frontend_type>password</frontend_type>
|
34 |
+
<sort_order>3</sort_order>
|
35 |
+
<show_in_default>1</show_in_default>
|
36 |
+
<show_in_website>1</show_in_website>
|
37 |
+
<show_in_store>1</show_in_store>
|
38 |
+
</freightpwd>
|
39 |
+
<!-- <freightlicensekey translate="label">
|
40 |
+
<label>License Key</label>
|
41 |
+
<frontend_type>text</frontend_type>
|
42 |
+
<sort_order>4</sort_order>
|
43 |
+
<show_in_default>1</show_in_default>
|
44 |
+
<show_in_website>1</show_in_website>
|
45 |
+
<show_in_store>1</show_in_store>
|
46 |
+
</freightlicensekey>-->
|
47 |
+
<name translate="label">
|
48 |
+
<label>Method Name</label>
|
49 |
+
<frontend_type>text</frontend_type>
|
50 |
+
<sort_order>5</sort_order>
|
51 |
+
<show_in_default>1</show_in_default>
|
52 |
+
<show_in_website>1</show_in_website>
|
53 |
+
<show_in_store>1</show_in_store>
|
54 |
+
</name>
|
55 |
+
<url translate="label">
|
56 |
+
<label>Api GetRate Url</label>
|
57 |
+
<frontend_type>text</frontend_type>
|
58 |
+
<sort_order>5</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 |
+
<comment>Default Api Url is: http://api.freightcenter.com/V04/rates.asmx </comment>
|
63 |
+
</url>
|
64 |
+
<sandbox translate="label">
|
65 |
+
<label>Sandbox</label>
|
66 |
+
<frontend_type>select</frontend_type>
|
67 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
68 |
+
<sort_order>1</sort_order>
|
69 |
+
<show_in_default>1</show_in_default>
|
70 |
+
<show_in_website>1</show_in_website>
|
71 |
+
<show_in_store>1</show_in_store>
|
72 |
+
</sandbox>
|
73 |
+
<title translate="label">
|
74 |
+
<label>Title</label>
|
75 |
+
<frontend_type>text</frontend_type>
|
76 |
+
<sort_order>6</sort_order>
|
77 |
+
<show_in_default>1</show_in_default>
|
78 |
+
<show_in_website>1</show_in_website>
|
79 |
+
<show_in_store>1</show_in_store>
|
80 |
+
</title>
|
81 |
+
<dest_loctype translate="label">
|
82 |
+
<label>Destination Location Type</label>
|
83 |
+
<frontend_model>ship/adminhtml_system_config_destloctype</frontend_model>
|
84 |
+
<sort_order>7</sort_order>
|
85 |
+
<show_in_default>1</show_in_default>
|
86 |
+
<show_in_website>1</show_in_website>
|
87 |
+
<show_in_store>1</show_in_store>
|
88 |
+
</dest_loctype>
|
89 |
+
<markup translate="label">
|
90 |
+
<label>Markup/Discount Mode</label>
|
91 |
+
<frontend_type>select</frontend_type>
|
92 |
+
<show_in_default>1</show_in_default>
|
93 |
+
<source_model>ship/mark</source_model>
|
94 |
+
<sort_order>8</sort_order>
|
95 |
+
<show_in_website>1</show_in_website>
|
96 |
+
<show_in_store>1</show_in_store>
|
97 |
+
</markup>
|
98 |
+
<markup_type translate="label">
|
99 |
+
<label>Markup Type</label>
|
100 |
+
<frontend_type>select</frontend_type>
|
101 |
+
<source_model>ship/types</source_model>
|
102 |
+
<sort_order>8</sort_order>
|
103 |
+
<show_in_default>1</show_in_default>
|
104 |
+
<show_in_website>1</show_in_website>
|
105 |
+
<show_in_store>1</show_in_store>
|
106 |
+
|
107 |
+
</markup_type>
|
108 |
+
<markup_price translate="label">
|
109 |
+
<label>Markup Amount</label>
|
110 |
+
<frontend_type>text</frontend_type>
|
111 |
+
<sort_order>9</sort_order>
|
112 |
+
<show_in_default>1</show_in_default>
|
113 |
+
<show_in_website>1</show_in_website>
|
114 |
+
<show_in_store>1</show_in_store>
|
115 |
+
<comment>Only Numerical Value Entered</comment>
|
116 |
+
</markup_price>
|
117 |
+
<positions translate="label">
|
118 |
+
<label>Carrier List</label>
|
119 |
+
<frontend_model>ship/adminhtml_system_config_positions</frontend_model>
|
120 |
+
<sort_order>10</sort_order>
|
121 |
+
<show_in_default>1</show_in_default>
|
122 |
+
<show_in_website>1</show_in_website>
|
123 |
+
<show_in_store>1</show_in_store>
|
124 |
+
</positions>
|
125 |
+
<carrier_display translate="label">
|
126 |
+
<label>Number of Carriers to Display per Shipment</label>
|
127 |
+
<frontend_type>select</frontend_type>
|
128 |
+
<frontend_model>ship/adminhtml_system_config_cdisplay</frontend_model>
|
129 |
+
<sort_order>11</sort_order>
|
130 |
+
<show_in_default>1</show_in_default>
|
131 |
+
<show_in_website>1</show_in_website>
|
132 |
+
<show_in_store>1</show_in_store>
|
133 |
+
</carrier_display>
|
134 |
+
<breakout_lineitems translate="label">
|
135 |
+
<label>Freight Charge Display Mode</label>
|
136 |
+
<frontend_type>select</frontend_type>
|
137 |
+
<source_model>ship/mode</source_model>
|
138 |
+
<sort_order>12</sort_order>
|
139 |
+
<show_in_default>1</show_in_default>
|
140 |
+
<show_in_website>1</show_in_website>
|
141 |
+
<show_in_store>1</show_in_store>
|
142 |
+
</breakout_lineitems>
|
143 |
+
<!-- <specificerrmsg translate="label">
|
144 |
+
<label>Displayed Error Message</label>
|
145 |
+
<frontend_type>textarea</frontend_type>
|
146 |
+
<sort_order>7</sort_order>
|
147 |
+
<show_in_default>1</show_in_default>
|
148 |
+
<show_in_website>1</show_in_website>
|
149 |
+
<show_in_store>1</show_in_store>
|
150 |
+
</specificerrmsg>-->
|
151 |
+
<sallowspecific translate="label">
|
152 |
+
<label>Ship to Applicable Countries</label>
|
153 |
+
<frontend_type>select</frontend_type>
|
154 |
+
<sort_order>90</sort_order>
|
155 |
+
<frontend_class>shipping-applicable-country</frontend_class>
|
156 |
+
<source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
|
157 |
+
<show_in_default>1</show_in_default>
|
158 |
+
<show_in_website>1</show_in_website>
|
159 |
+
<show_in_store>0</show_in_store>
|
160 |
+
</sallowspecific>
|
161 |
+
<specificcountry translate="label">
|
162 |
+
<label>Ship to Specific Countries</label>
|
163 |
+
<frontend_type>multiselect</frontend_type>
|
164 |
+
<sort_order>91</sort_order>
|
165 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
166 |
+
<show_in_default>1</show_in_default>
|
167 |
+
<show_in_website>1</show_in_website>
|
168 |
+
<show_in_store>0</show_in_store>
|
169 |
+
<can_be_empty>1</can_be_empty>
|
170 |
+
</specificcountry>
|
171 |
+
</fields>
|
172 |
+
</freightcenter>
|
173 |
+
</groups>
|
174 |
+
</carriers>
|
175 |
+
</sections>
|
176 |
+
</config>
|
app/code/local/Freightcenter/Ship/etc/system.xml@30July
ADDED
@@ -0,0 +1,228 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<carriers>
|
5 |
+
<groups>
|
6 |
+
<freightcenter translate="label" module="ship">
|
7 |
+
<label>FreightCenter Shipping Module</label>
|
8 |
+
<frontend_type>text</frontend_type>
|
9 |
+
<sort_order>99</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 |
+
<active translate="label">
|
15 |
+
<label>Enabled</label>
|
16 |
+
<frontend_type>select</frontend_type>
|
17 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
18 |
+
<sort_order>1</sort_order>
|
19 |
+
<show_in_default>1</show_in_default>
|
20 |
+
<show_in_website>1</show_in_website>
|
21 |
+
<show_in_store>1</show_in_store>
|
22 |
+
</active>
|
23 |
+
<freightuser translate="label">
|
24 |
+
<label>Username</label>
|
25 |
+
<frontend_type>text</frontend_type>
|
26 |
+
<sort_order>2</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 |
+
</freightuser>
|
31 |
+
<freightpwd translate="label">
|
32 |
+
<label>Password</label>
|
33 |
+
<frontend_type>password</frontend_type>
|
34 |
+
<sort_order>3</sort_order>
|
35 |
+
<show_in_default>1</show_in_default>
|
36 |
+
<show_in_website>1</show_in_website>
|
37 |
+
<show_in_store>1</show_in_store>
|
38 |
+
</freightpwd>
|
39 |
+
<!-- <freightlicensekey translate="label">
|
40 |
+
<label>License Key</label>
|
41 |
+
<frontend_type>text</frontend_type>
|
42 |
+
<sort_order>4</sort_order>
|
43 |
+
<show_in_default>1</show_in_default>
|
44 |
+
<show_in_website>1</show_in_website>
|
45 |
+
<show_in_store>1</show_in_store>
|
46 |
+
</freightlicensekey>-->
|
47 |
+
<name translate="label">
|
48 |
+
<label>Method Name</label>
|
49 |
+
<frontend_type>text</frontend_type>
|
50 |
+
<sort_order>5</sort_order>
|
51 |
+
<show_in_default>1</show_in_default>
|
52 |
+
<show_in_website>1</show_in_website>
|
53 |
+
<show_in_store>1</show_in_store>
|
54 |
+
</name>
|
55 |
+
<apirateurl translate="label">
|
56 |
+
<label>ApiRates</label>
|
57 |
+
<frontend_type>text</frontend_type>
|
58 |
+
<sort_order>5</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 |
+
<comment>Default Api Url is: api.freightcenter.com/v04/rates.asmx </comment>
|
63 |
+
</apirateurl>
|
64 |
+
<apishipmenturl translate="label">
|
65 |
+
<label>Api Shipments</label>
|
66 |
+
<frontend_type>text</frontend_type>
|
67 |
+
<sort_order>5</sort_order>
|
68 |
+
<show_in_default>1</show_in_default>
|
69 |
+
<show_in_website>1</show_in_website>
|
70 |
+
<show_in_store>1</show_in_store>
|
71 |
+
<comment>Default Api Url is: api.freightcenter.com/v04/shipments.asmx </comment>
|
72 |
+
</apishipmenturl>
|
73 |
+
<apicarriersurl translate="label">
|
74 |
+
<label>Api Carriers</label>
|
75 |
+
<frontend_type>text</frontend_type>
|
76 |
+
<sort_order>5</sort_order>
|
77 |
+
<show_in_default>1</show_in_default>
|
78 |
+
<show_in_website>1</show_in_website>
|
79 |
+
<show_in_store>1</show_in_store>
|
80 |
+
<comment>Default Api Url is: api.freightcenter.com/v04/carriers.asmx</comment>
|
81 |
+
</apicarriersurl>
|
82 |
+
<sandbox translate="label">
|
83 |
+
<label>Mode</label>
|
84 |
+
<frontend_type>select</frontend_type>
|
85 |
+
<source_model>ship/sand</source_model>
|
86 |
+
<sort_order>1</sort_order>
|
87 |
+
<show_in_default>1</show_in_default>
|
88 |
+
<show_in_website>1</show_in_website>
|
89 |
+
<show_in_store>1</show_in_store>
|
90 |
+
</sandbox>
|
91 |
+
<title translate="label">
|
92 |
+
<label>Title</label>
|
93 |
+
<frontend_type>text</frontend_type>
|
94 |
+
<sort_order>6</sort_order>
|
95 |
+
<show_in_default>1</show_in_default>
|
96 |
+
<show_in_website>1</show_in_website>
|
97 |
+
<show_in_store>1</show_in_store>
|
98 |
+
</title>
|
99 |
+
<dest_loctype translate="label">
|
100 |
+
<label>Destination Location Type</label>
|
101 |
+
<frontend_model>ship/adminhtml_system_config_destloctype</frontend_model>
|
102 |
+
<sort_order>7</sort_order>
|
103 |
+
<show_in_default>1</show_in_default>
|
104 |
+
<show_in_website>1</show_in_website>
|
105 |
+
<show_in_store>1</show_in_store>
|
106 |
+
</dest_loctype>
|
107 |
+
<markup translate="label">
|
108 |
+
<label>Markup/Discount Mode</label>
|
109 |
+
<frontend_type>select</frontend_type>
|
110 |
+
<show_in_default>1</show_in_default>
|
111 |
+
<source_model>ship/mark</source_model>
|
112 |
+
<sort_order>8</sort_order>
|
113 |
+
<show_in_website>1</show_in_website>
|
114 |
+
<show_in_store>1</show_in_store>
|
115 |
+
</markup>
|
116 |
+
<markup_type translate="label">
|
117 |
+
<label>Markup Type</label>
|
118 |
+
<frontend_type>select</frontend_type>
|
119 |
+
<source_model>ship/types</source_model>
|
120 |
+
<sort_order>8</sort_order>
|
121 |
+
<show_in_default>1</show_in_default>
|
122 |
+
<show_in_website>1</show_in_website>
|
123 |
+
<show_in_store>1</show_in_store>
|
124 |
+
|
125 |
+
</markup_type>
|
126 |
+
<markup_price translate="label">
|
127 |
+
<label>Markup Amount</label>
|
128 |
+
<frontend_type>text</frontend_type>
|
129 |
+
<sort_order>9</sort_order>
|
130 |
+
<show_in_default>1</show_in_default>
|
131 |
+
<show_in_website>1</show_in_website>
|
132 |
+
<show_in_store>1</show_in_store>
|
133 |
+
<comment>Only Numerical Value Entered</comment>
|
134 |
+
</markup_price>
|
135 |
+
<discount_amount translate="label">
|
136 |
+
<label>Minimum Amount for Discounted Shipping</label>
|
137 |
+
<frontend_type>text</frontend_type>
|
138 |
+
<sort_order>7</sort_order>
|
139 |
+
<show_in_default>1</show_in_default>
|
140 |
+
<show_in_website>1</show_in_website>
|
141 |
+
<show_in_store>1</show_in_store>
|
142 |
+
<comment>Only Numerical Value Entered</comment>
|
143 |
+
</discount_amount>
|
144 |
+
<discount translate="label">
|
145 |
+
<label>Discounted Shipping After Minimum Order Amount</label>
|
146 |
+
<frontend_type>select</frontend_type>
|
147 |
+
<source_model>ship/Discount</source_model>
|
148 |
+
<sort_order>7</sort_order>
|
149 |
+
<show_in_default>1</show_in_default>
|
150 |
+
<show_in_website>1</show_in_website>
|
151 |
+
<show_in_store>1</show_in_store>
|
152 |
+
|
153 |
+
</discount>
|
154 |
+
|
155 |
+
<discount_price translate="label">
|
156 |
+
<label>Discounted Shipping price (Dollar Amount)</label>
|
157 |
+
<frontend_type>text</frontend_type>
|
158 |
+
<sort_order>7</sort_order>
|
159 |
+
<show_in_default>1</show_in_default>
|
160 |
+
<show_in_website>1</show_in_website>
|
161 |
+
<show_in_store>1</show_in_store>
|
162 |
+
<comment>Only Numerical Value Entered</comment>
|
163 |
+
</discount_price>
|
164 |
+
|
165 |
+
|
166 |
+
|
167 |
+
|
168 |
+
|
169 |
+
<positions translate="label">
|
170 |
+
<label>Carrier List</label>
|
171 |
+
<frontend_model>ship/adminhtml_system_config_positions</frontend_model>
|
172 |
+
<sort_order>10</sort_order>
|
173 |
+
<show_in_default>1</show_in_default>
|
174 |
+
<show_in_website>1</show_in_website>
|
175 |
+
<show_in_store>1</show_in_store>
|
176 |
+
</positions>
|
177 |
+
<carrier_display translate="label">
|
178 |
+
<label>Number of Carriers to Display per Shipment</label>
|
179 |
+
<frontend_type>select</frontend_type>
|
180 |
+
<frontend_model>ship/adminhtml_system_config_cdisplay</frontend_model>
|
181 |
+
<sort_order>11</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 |
+
</carrier_display>
|
186 |
+
<breakout_lineitems translate="label">
|
187 |
+
<label>Freight Charge Display Mode</label>
|
188 |
+
<frontend_type>select</frontend_type>
|
189 |
+
<source_model>ship/mode</source_model>
|
190 |
+
<sort_order>12</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 |
+
</breakout_lineitems>
|
195 |
+
<!-- <specificerrmsg translate="label">
|
196 |
+
<label>Displayed Error Message</label>
|
197 |
+
<frontend_type>textarea</frontend_type>
|
198 |
+
<sort_order>7</sort_order>
|
199 |
+
<show_in_default>1</show_in_default>
|
200 |
+
<show_in_website>1</show_in_website>
|
201 |
+
<show_in_store>1</show_in_store>
|
202 |
+
</specificerrmsg>-->
|
203 |
+
<sallowspecific translate="label">
|
204 |
+
<label>Ship to Applicable Countries</label>
|
205 |
+
<frontend_type>select</frontend_type>
|
206 |
+
<sort_order>90</sort_order>
|
207 |
+
<frontend_class>shipping-applicable-country</frontend_class>
|
208 |
+
<source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
|
209 |
+
<show_in_default>1</show_in_default>
|
210 |
+
<show_in_website>1</show_in_website>
|
211 |
+
<show_in_store>0</show_in_store>
|
212 |
+
</sallowspecific>
|
213 |
+
<specificcountry translate="label">
|
214 |
+
<label>Ship to Specific Countries</label>
|
215 |
+
<frontend_type>multiselect</frontend_type>
|
216 |
+
<sort_order>91</sort_order>
|
217 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
218 |
+
<show_in_default>1</show_in_default>
|
219 |
+
<show_in_website>1</show_in_website>
|
220 |
+
<show_in_store>0</show_in_store>
|
221 |
+
<can_be_empty>1</can_be_empty>
|
222 |
+
</specificcountry>
|
223 |
+
</fields>
|
224 |
+
</freightcenter>
|
225 |
+
</groups>
|
226 |
+
</carriers>
|
227 |
+
</sections>
|
228 |
+
</config>
|
app/code/local/Freightcenters/Freight/controllers/CartController.php
ADDED
@@ -0,0 +1,561 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once 'Mage/Checkout/controllers/CartController.php';
|
3 |
+
class Freightcenter_Ship_CartController extends Mage_Checkout_CartController
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Action list where need check enabled cookie
|
7 |
+
*
|
8 |
+
* @var array
|
9 |
+
*/
|
10 |
+
|
11 |
+
protected $_cookieCheckActions = array('add');
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Retrieve shopping cart model object
|
15 |
+
*
|
16 |
+
* @return Mage_Checkout_Model_Cart
|
17 |
+
*/
|
18 |
+
protected function _getCart()
|
19 |
+
{
|
20 |
+
return Mage::getSingleton('checkout/cart');
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Get checkout session model instance
|
25 |
+
*
|
26 |
+
* @return Mage_Checkout_Model_Session
|
27 |
+
*/
|
28 |
+
protected function _getSession()
|
29 |
+
{
|
30 |
+
return Mage::getSingleton('checkout/session');
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Get current active quote instance
|
35 |
+
*
|
36 |
+
* @return Mage_Sales_Model_Quote
|
37 |
+
*/
|
38 |
+
protected function _getQuote()
|
39 |
+
{
|
40 |
+
return $this->_getCart()->getQuote();
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Set back redirect url to response
|
45 |
+
*
|
46 |
+
* @return Mage_Checkout_CartController
|
47 |
+
* @throws Mage_Exception
|
48 |
+
*/
|
49 |
+
protected function _goBack()
|
50 |
+
{
|
51 |
+
$returnUrl = $this->getRequest()->getParam('return_url');
|
52 |
+
if ($returnUrl) {
|
53 |
+
|
54 |
+
if (!$this->_isUrlInternal($returnUrl)) {
|
55 |
+
throw new Mage_Exception('External urls redirect to "' . $returnUrl . '" denied!');
|
56 |
+
}
|
57 |
+
|
58 |
+
$this->_getSession()->getMessages(true);
|
59 |
+
$this->getResponse()->setRedirect($returnUrl);
|
60 |
+
} elseif (!Mage::getStoreConfig('checkout/cart/redirect_to_cart')
|
61 |
+
&& !$this->getRequest()->getParam('in_cart')
|
62 |
+
&& $backUrl = $this->_getRefererUrl()
|
63 |
+
) {
|
64 |
+
$this->getResponse()->setRedirect($backUrl);
|
65 |
+
} else {
|
66 |
+
if (($this->getRequest()->getActionName() == 'add') && !$this->getRequest()->getParam('in_cart')) {
|
67 |
+
$this->_getSession()->setContinueShoppingUrl($this->_getRefererUrl());
|
68 |
+
}
|
69 |
+
$this->_redirect('checkout/cart');
|
70 |
+
}
|
71 |
+
return $this;
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Initialize product instance from request data
|
76 |
+
*
|
77 |
+
* @return Mage_Catalog_Model_Product || false
|
78 |
+
*/
|
79 |
+
protected function _initProduct()
|
80 |
+
{
|
81 |
+
$productId = (int) $this->getRequest()->getParam('product');
|
82 |
+
if ($productId) {
|
83 |
+
$product = Mage::getModel('catalog/product')
|
84 |
+
->setStoreId(Mage::app()->getStore()->getId())
|
85 |
+
->load($productId);
|
86 |
+
if ($product->getId()) {
|
87 |
+
return $product;
|
88 |
+
}
|
89 |
+
}
|
90 |
+
return false;
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Shopping cart display action
|
95 |
+
*/
|
96 |
+
public function indexAction()
|
97 |
+
{
|
98 |
+
$cart = $this->_getCart();
|
99 |
+
if ($cart->getQuote()->getItemsCount()) {
|
100 |
+
$cart->init();
|
101 |
+
$cart->save();
|
102 |
+
|
103 |
+
if (!$this->_getQuote()->validateMinimumAmount()) {
|
104 |
+
$minimumAmount = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())
|
105 |
+
->toCurrency(Mage::getStoreConfig('sales/minimum_order/amount'));
|
106 |
+
|
107 |
+
$warning = Mage::getStoreConfig('sales/minimum_order/description')
|
108 |
+
? Mage::getStoreConfig('sales/minimum_order/description')
|
109 |
+
: Mage::helper('checkout')->__('Minimum order amount is %s', $minimumAmount);
|
110 |
+
|
111 |
+
$cart->getCheckoutSession()->addNotice($warning);
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
+
// Compose array of messages to add
|
116 |
+
$messages = array();
|
117 |
+
foreach ($cart->getQuote()->getMessages() as $message) {
|
118 |
+
if ($message) {
|
119 |
+
// Escape HTML entities in quote message to prevent XSS
|
120 |
+
$message->setCode(Mage::helper('core')->escapeHtml($message->getCode()));
|
121 |
+
$messages[] = $message;
|
122 |
+
}
|
123 |
+
}
|
124 |
+
$cart->getCheckoutSession()->addUniqueMessages($messages);
|
125 |
+
|
126 |
+
/**
|
127 |
+
* if customer enteres shopping cart we should mark quote
|
128 |
+
* as modified bc he can has checkout page in another window.
|
129 |
+
*/
|
130 |
+
$this->_getSession()->setCartWasUpdated(true);
|
131 |
+
|
132 |
+
Varien_Profiler::start(__METHOD__ . 'cart_display');
|
133 |
+
$this
|
134 |
+
->loadLayout()
|
135 |
+
->_initLayoutMessages('checkout/session')
|
136 |
+
->_initLayoutMessages('catalog/session')
|
137 |
+
->getLayout()->getBlock('head')->setTitle($this->__('Shopping Cart'));
|
138 |
+
$this->renderLayout();
|
139 |
+
Varien_Profiler::stop(__METHOD__ . 'cart_display');
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Add product to shopping cart action
|
144 |
+
*
|
145 |
+
* @return Mage_Core_Controller_Varien_Action
|
146 |
+
* @throws Exception
|
147 |
+
*/
|
148 |
+
public function addAction()
|
149 |
+
{
|
150 |
+
if (!$this->_validateFormKey()) {
|
151 |
+
$this->_goBack();
|
152 |
+
return;
|
153 |
+
}
|
154 |
+
$cart = $this->_getCart();
|
155 |
+
$params = $this->getRequest()->getParams();
|
156 |
+
try {
|
157 |
+
if (isset($params['qty'])) {
|
158 |
+
$filter = new Zend_Filter_LocalizedToNormalized(
|
159 |
+
array('locale' => Mage::app()->getLocale()->getLocaleCode())
|
160 |
+
);
|
161 |
+
$params['qty'] = $filter->filter($params['qty']);
|
162 |
+
}
|
163 |
+
|
164 |
+
$product = $this->_initProduct();
|
165 |
+
$related = $this->getRequest()->getParam('related_product');
|
166 |
+
|
167 |
+
/**
|
168 |
+
* Check product availability
|
169 |
+
*/
|
170 |
+
if (!$product) {
|
171 |
+
$this->_goBack();
|
172 |
+
return;
|
173 |
+
}
|
174 |
+
|
175 |
+
$cart->addProduct($product, $params);
|
176 |
+
if (!empty($related)) {
|
177 |
+
$cart->addProductsByIds(explode(',', $related));
|
178 |
+
}
|
179 |
+
|
180 |
+
$cart->save();
|
181 |
+
|
182 |
+
$this->_getSession()->setCartWasUpdated(true);
|
183 |
+
|
184 |
+
/**
|
185 |
+
* @todo remove wishlist observer processAddToCart
|
186 |
+
*/
|
187 |
+
Mage::dispatchEvent('checkout_cart_add_product_complete',
|
188 |
+
array('product' => $product, 'request' => $this->getRequest(), 'response' => $this->getResponse())
|
189 |
+
);
|
190 |
+
|
191 |
+
if (!$this->_getSession()->getNoCartRedirect(true)) {
|
192 |
+
if (!$cart->getQuote()->getHasError()) {
|
193 |
+
$message = $this->__('%s was added to your shopping cart.', Mage::helper('core')->escapeHtml($product->getName()));
|
194 |
+
$this->_getSession()->addSuccess($message);
|
195 |
+
}
|
196 |
+
$this->_goBack();
|
197 |
+
}
|
198 |
+
} catch (Mage_Core_Exception $e) {
|
199 |
+
if ($this->_getSession()->getUseNotice(true)) {
|
200 |
+
$this->_getSession()->addNotice(Mage::helper('core')->escapeHtml($e->getMessage()));
|
201 |
+
} else {
|
202 |
+
$messages = array_unique(explode("\n", $e->getMessage()));
|
203 |
+
foreach ($messages as $message) {
|
204 |
+
$this->_getSession()->addError(Mage::helper('core')->escapeHtml($message));
|
205 |
+
}
|
206 |
+
}
|
207 |
+
|
208 |
+
$url = $this->_getSession()->getRedirectUrl(true);
|
209 |
+
if ($url) {
|
210 |
+
$this->getResponse()->setRedirect($url);
|
211 |
+
} else {
|
212 |
+
$this->_redirectReferer(Mage::helper('checkout/cart')->getCartUrl());
|
213 |
+
}
|
214 |
+
} catch (Exception $e) {
|
215 |
+
$this->_getSession()->addException($e, $this->__('Cannot add the item to shopping cart.'));
|
216 |
+
Mage::logException($e);
|
217 |
+
$this->_goBack();
|
218 |
+
}
|
219 |
+
}
|
220 |
+
|
221 |
+
/**
|
222 |
+
* Add products in group to shopping cart action
|
223 |
+
*/
|
224 |
+
public function addgroupAction()
|
225 |
+
{
|
226 |
+
$orderItemIds = $this->getRequest()->getParam('order_items', array());
|
227 |
+
|
228 |
+
if (!is_array($orderItemIds) || !$this->_validateFormKey()) {
|
229 |
+
$this->_goBack();
|
230 |
+
return;
|
231 |
+
}
|
232 |
+
|
233 |
+
$itemsCollection = Mage::getModel('sales/order_item')
|
234 |
+
->getCollection()
|
235 |
+
->addIdFilter($orderItemIds)
|
236 |
+
->load();
|
237 |
+
/* @var $itemsCollection Mage_Sales_Model_Mysql4_Order_Item_Collection */
|
238 |
+
$cart = $this->_getCart();
|
239 |
+
foreach ($itemsCollection as $item) {
|
240 |
+
try {
|
241 |
+
$cart->addOrderItem($item, 1);
|
242 |
+
} catch (Mage_Core_Exception $e) {
|
243 |
+
if ($this->_getSession()->getUseNotice(true)) {
|
244 |
+
$this->_getSession()->addNotice($e->getMessage());
|
245 |
+
} else {
|
246 |
+
$this->_getSession()->addError($e->getMessage());
|
247 |
+
}
|
248 |
+
} catch (Exception $e) {
|
249 |
+
$this->_getSession()->addException($e, $this->__('Cannot add the item to shopping cart.'));
|
250 |
+
Mage::logException($e);
|
251 |
+
$this->_goBack();
|
252 |
+
}
|
253 |
+
}
|
254 |
+
$cart->save();
|
255 |
+
$this->_getSession()->setCartWasUpdated(true);
|
256 |
+
$this->_goBack();
|
257 |
+
}
|
258 |
+
|
259 |
+
/**
|
260 |
+
* Action to reconfigure cart item
|
261 |
+
*/
|
262 |
+
public function configureAction()
|
263 |
+
{
|
264 |
+
// Extract item and product to configure
|
265 |
+
$id = (int) $this->getRequest()->getParam('id');
|
266 |
+
$quoteItem = null;
|
267 |
+
$cart = $this->_getCart();
|
268 |
+
if ($id) {
|
269 |
+
$quoteItem = $cart->getQuote()->getItemById($id);
|
270 |
+
}
|
271 |
+
|
272 |
+
if (!$quoteItem) {
|
273 |
+
$this->_getSession()->addError($this->__('Quote item is not found.'));
|
274 |
+
$this->_redirect('checkout/cart');
|
275 |
+
return;
|
276 |
+
}
|
277 |
+
|
278 |
+
try {
|
279 |
+
$params = new Varien_Object();
|
280 |
+
$params->setCategoryId(false);
|
281 |
+
$params->setConfigureMode(true);
|
282 |
+
$params->setBuyRequest($quoteItem->getBuyRequest());
|
283 |
+
|
284 |
+
Mage::helper('catalog/product_view')->prepareAndRender($quoteItem->getProduct()->getId(), $this, $params);
|
285 |
+
} catch (Exception $e) {
|
286 |
+
$this->_getSession()->addError($this->__('Cannot configure product.'));
|
287 |
+
Mage::logException($e);
|
288 |
+
$this->_goBack();
|
289 |
+
return;
|
290 |
+
}
|
291 |
+
}
|
292 |
+
|
293 |
+
/**
|
294 |
+
* Update product configuration for a cart item
|
295 |
+
*/
|
296 |
+
public function updateItemOptionsAction()
|
297 |
+
{
|
298 |
+
$cart = $this->_getCart();
|
299 |
+
$id = (int) $this->getRequest()->getParam('id');
|
300 |
+
$params = $this->getRequest()->getParams();
|
301 |
+
|
302 |
+
if (!isset($params['options'])) {
|
303 |
+
$params['options'] = array();
|
304 |
+
}
|
305 |
+
try {
|
306 |
+
if (isset($params['qty'])) {
|
307 |
+
$filter = new Zend_Filter_LocalizedToNormalized(
|
308 |
+
array('locale' => Mage::app()->getLocale()->getLocaleCode())
|
309 |
+
);
|
310 |
+
$params['qty'] = $filter->filter($params['qty']);
|
311 |
+
}
|
312 |
+
|
313 |
+
$quoteItem = $cart->getQuote()->getItemById($id);
|
314 |
+
if (!$quoteItem) {
|
315 |
+
Mage::throwException($this->__('Quote item is not found.'));
|
316 |
+
}
|
317 |
+
|
318 |
+
$item = $cart->updateItem($id, new Varien_Object($params));
|
319 |
+
if (is_string($item)) {
|
320 |
+
Mage::throwException($item);
|
321 |
+
}
|
322 |
+
if ($item->getHasError()) {
|
323 |
+
Mage::throwException($item->getMessage());
|
324 |
+
}
|
325 |
+
|
326 |
+
$related = $this->getRequest()->getParam('related_product');
|
327 |
+
if (!empty($related)) {
|
328 |
+
$cart->addProductsByIds(explode(',', $related));
|
329 |
+
}
|
330 |
+
|
331 |
+
$cart->save();
|
332 |
+
|
333 |
+
$this->_getSession()->setCartWasUpdated(true);
|
334 |
+
|
335 |
+
Mage::dispatchEvent('checkout_cart_update_item_complete',
|
336 |
+
array('item' => $item, 'request' => $this->getRequest(), 'response' => $this->getResponse())
|
337 |
+
);
|
338 |
+
if (!$this->_getSession()->getNoCartRedirect(true)) {
|
339 |
+
if (!$cart->getQuote()->getHasError()) {
|
340 |
+
$message = $this->__('%s was updated in your shopping cart.', Mage::helper('core')->escapeHtml($item->getProduct()->getName()));
|
341 |
+
$this->_getSession()->addSuccess($message);
|
342 |
+
}
|
343 |
+
$this->_goBack();
|
344 |
+
}
|
345 |
+
} catch (Mage_Core_Exception $e) {
|
346 |
+
if ($this->_getSession()->getUseNotice(true)) {
|
347 |
+
$this->_getSession()->addNotice($e->getMessage());
|
348 |
+
} else {
|
349 |
+
$messages = array_unique(explode("\n", $e->getMessage()));
|
350 |
+
foreach ($messages as $message) {
|
351 |
+
$this->_getSession()->addError($message);
|
352 |
+
}
|
353 |
+
}
|
354 |
+
|
355 |
+
$url = $this->_getSession()->getRedirectUrl(true);
|
356 |
+
if ($url) {
|
357 |
+
$this->getResponse()->setRedirect($url);
|
358 |
+
} else {
|
359 |
+
$this->_redirectReferer(Mage::helper('checkout/cart')->getCartUrl());
|
360 |
+
}
|
361 |
+
} catch (Exception $e) {
|
362 |
+
$this->_getSession()->addException($e, $this->__('Cannot update the item.'));
|
363 |
+
Mage::logException($e);
|
364 |
+
$this->_goBack();
|
365 |
+
}
|
366 |
+
$this->_redirect('*/*');
|
367 |
+
}
|
368 |
+
|
369 |
+
/**
|
370 |
+
* Update shopping cart data action
|
371 |
+
*/
|
372 |
+
public function updatePostAction()
|
373 |
+
{
|
374 |
+
if (!$this->_validateFormKey()) {
|
375 |
+
$this->_redirect('*/*/');
|
376 |
+
return;
|
377 |
+
}
|
378 |
+
|
379 |
+
$updateAction = (string)$this->getRequest()->getParam('update_cart_action');
|
380 |
+
|
381 |
+
switch ($updateAction) {
|
382 |
+
case 'empty_cart':
|
383 |
+
$this->_emptyShoppingCart();
|
384 |
+
break;
|
385 |
+
case 'update_qty':
|
386 |
+
$this->_updateShoppingCart();
|
387 |
+
break;
|
388 |
+
default:
|
389 |
+
$this->_updateShoppingCart();
|
390 |
+
}
|
391 |
+
|
392 |
+
$this->_goBack();
|
393 |
+
}
|
394 |
+
|
395 |
+
/**
|
396 |
+
* Update customer's shopping cart
|
397 |
+
*/
|
398 |
+
protected function _updateShoppingCart()
|
399 |
+
{
|
400 |
+
try {
|
401 |
+
$cartData = $this->getRequest()->getParam('cart');
|
402 |
+
if (is_array($cartData)) {
|
403 |
+
$filter = new Zend_Filter_LocalizedToNormalized(
|
404 |
+
array('locale' => Mage::app()->getLocale()->getLocaleCode())
|
405 |
+
);
|
406 |
+
foreach ($cartData as $index => $data) {
|
407 |
+
if (isset($data['qty'])) {
|
408 |
+
$cartData[$index]['qty'] = $filter->filter(trim($data['qty']));
|
409 |
+
}
|
410 |
+
}
|
411 |
+
$cart = $this->_getCart();
|
412 |
+
if (! $cart->getCustomerSession()->getCustomer()->getId() && $cart->getQuote()->getCustomerId()) {
|
413 |
+
$cart->getQuote()->setCustomerId(null);
|
414 |
+
}
|
415 |
+
|
416 |
+
$cartData = $cart->suggestItemsQty($cartData);
|
417 |
+
$cart->updateItems($cartData)
|
418 |
+
->save();
|
419 |
+
}
|
420 |
+
$this->_getSession()->setCartWasUpdated(true);
|
421 |
+
} catch (Mage_Core_Exception $e) {
|
422 |
+
$this->_getSession()->addError(Mage::helper('core')->escapeHtml($e->getMessage()));
|
423 |
+
} catch (Exception $e) {
|
424 |
+
$this->_getSession()->addException($e, $this->__('Cannot update shopping cart.'));
|
425 |
+
Mage::logException($e);
|
426 |
+
}
|
427 |
+
}
|
428 |
+
|
429 |
+
/**
|
430 |
+
* Empty customer's shopping cart
|
431 |
+
*/
|
432 |
+
protected function _emptyShoppingCart()
|
433 |
+
{
|
434 |
+
try {
|
435 |
+
$this->_getCart()->truncate()->save();
|
436 |
+
$this->_getSession()->setCartWasUpdated(true);
|
437 |
+
/*Delete from table based on quote id*/
|
438 |
+
$session = Mage::getSingleton('checkout/session');
|
439 |
+
$quoteid = $session->getQuoteId();
|
440 |
+
$resource = Mage::getSingleton('core/resource');
|
441 |
+
$connection = $resource->getConnection('core_write');
|
442 |
+
$query = "Delete from `brst_freight_shipping` where quote_id=$quoteid";
|
443 |
+
$connection->query($query);
|
444 |
+
} catch (Mage_Core_Exception $exception) {
|
445 |
+
$this->_getSession()->addError($exception->getMessage());
|
446 |
+
} catch (Exception $exception) {
|
447 |
+
$this->_getSession()->addException($exception, $this->__('Cannot update shopping cart.'));
|
448 |
+
}
|
449 |
+
}
|
450 |
+
|
451 |
+
/**
|
452 |
+
* Delete shoping cart item action
|
453 |
+
*/
|
454 |
+
public function deleteAction()
|
455 |
+
{
|
456 |
+
$id = (int) $this->getRequest()->getParam('id');
|
457 |
+
if ($id) {
|
458 |
+
try {
|
459 |
+
$this->_getCart()->removeItem($id)
|
460 |
+
->save();
|
461 |
+
} catch (Exception $e) {
|
462 |
+
$this->_getSession()->addError($this->__('Cannot remove the item.'));
|
463 |
+
Mage::logException($e);
|
464 |
+
}
|
465 |
+
}
|
466 |
+
$this->_redirectReferer(Mage::getUrl('*/*'));
|
467 |
+
}
|
468 |
+
|
469 |
+
/**
|
470 |
+
* Initialize shipping information
|
471 |
+
*/
|
472 |
+
public function estimatePostAction()
|
473 |
+
{
|
474 |
+
$country = (string) $this->getRequest()->getParam('country_id');
|
475 |
+
$postcode = (string) $this->getRequest()->getParam('estimate_postcode');
|
476 |
+
$city = (string) $this->getRequest()->getParam('estimate_city');
|
477 |
+
$regionId = (string) $this->getRequest()->getParam('region_id');
|
478 |
+
$region = (string) $this->getRequest()->getParam('region');
|
479 |
+
|
480 |
+
$this->_getQuote()->getShippingAddress()
|
481 |
+
->setCountryId($country)
|
482 |
+
->setCity($city)
|
483 |
+
->setPostcode($postcode)
|
484 |
+
->setRegionId($regionId)
|
485 |
+
->setRegion($region)
|
486 |
+
->setCollectShippingRates(true);
|
487 |
+
$this->_getQuote()->save();
|
488 |
+
$this->_goBack();
|
489 |
+
}
|
490 |
+
|
491 |
+
/**
|
492 |
+
* Estimate update action
|
493 |
+
*
|
494 |
+
* @return null
|
495 |
+
*/
|
496 |
+
public function estimateUpdatePostAction()
|
497 |
+
{
|
498 |
+
$code = (string) $this->getRequest()->getParam('estimate_method');
|
499 |
+
if (!empty($code)) {
|
500 |
+
$this->_getQuote()->getShippingAddress()->setShippingMethod($code)/*->collectTotals()*/->save();
|
501 |
+
}
|
502 |
+
$this->_goBack();
|
503 |
+
}
|
504 |
+
|
505 |
+
/**
|
506 |
+
* Initialize coupon
|
507 |
+
*/
|
508 |
+
public function couponPostAction()
|
509 |
+
{
|
510 |
+
/**
|
511 |
+
* No reason continue with empty shopping cart
|
512 |
+
*/
|
513 |
+
if (!$this->_getCart()->getQuote()->getItemsCount()) {
|
514 |
+
$this->_goBack();
|
515 |
+
return;
|
516 |
+
}
|
517 |
+
|
518 |
+
$couponCode = (string) $this->getRequest()->getParam('coupon_code');
|
519 |
+
if ($this->getRequest()->getParam('remove') == 1) {
|
520 |
+
$couponCode = '';
|
521 |
+
}
|
522 |
+
$oldCouponCode = $this->_getQuote()->getCouponCode();
|
523 |
+
|
524 |
+
if (!strlen($couponCode) && !strlen($oldCouponCode)) {
|
525 |
+
$this->_goBack();
|
526 |
+
return;
|
527 |
+
}
|
528 |
+
|
529 |
+
try {
|
530 |
+
$codeLength = strlen($couponCode);
|
531 |
+
$isCodeLengthValid = $codeLength && $codeLength <= Mage_Checkout_Helper_Cart::COUPON_CODE_MAX_LENGTH;
|
532 |
+
|
533 |
+
$this->_getQuote()->getShippingAddress()->setCollectShippingRates(true);
|
534 |
+
$this->_getQuote()->setCouponCode($isCodeLengthValid ? $couponCode : '')
|
535 |
+
->collectTotals()
|
536 |
+
->save();
|
537 |
+
|
538 |
+
if ($codeLength) {
|
539 |
+
if ($isCodeLengthValid && $couponCode == $this->_getQuote()->getCouponCode()) {
|
540 |
+
$this->_getSession()->addSuccess(
|
541 |
+
$this->__('Coupon code "%s" was applied.', Mage::helper('core')->escapeHtml($couponCode))
|
542 |
+
);
|
543 |
+
} else {
|
544 |
+
$this->_getSession()->addError(
|
545 |
+
$this->__('Coupon code "%s" is not valid.', Mage::helper('core')->escapeHtml($couponCode))
|
546 |
+
);
|
547 |
+
}
|
548 |
+
} else {
|
549 |
+
$this->_getSession()->addSuccess($this->__('Coupon code was canceled.'));
|
550 |
+
}
|
551 |
+
|
552 |
+
} catch (Mage_Core_Exception $e) {
|
553 |
+
$this->_getSession()->addError($e->getMessage());
|
554 |
+
} catch (Exception $e) {
|
555 |
+
$this->_getSession()->addError($this->__('Cannot apply the coupon code.'));
|
556 |
+
Mage::logException($e);
|
557 |
+
}
|
558 |
+
|
559 |
+
$this->_goBack();
|
560 |
+
}
|
561 |
+
}
|
app/code/local/Freightcenters/Freight/controllers/IndexController.php
ADDED
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Freightcenters_Freight_IndexController extends Mage_Checkout_Controller_Action{
|
3 |
+
public function newindexAction(){
|
4 |
+
die('hello');
|
5 |
+
//// $bla = Mage::getSingleton('fee/index');
|
6 |
+
//$bla->setMsg("Thank You for your visit!");
|
7 |
+
//$this->loadLayout();
|
8 |
+
//$this->renderLayout();
|
9 |
+
|
10 |
+
}
|
11 |
+
public function myfunAction() {
|
12 |
+
$postData = $this->getRequest()->getPost();
|
13 |
+
//echo "<pre>";print_r($postData);exit;
|
14 |
+
|
15 |
+
$freight_price = $postData['val'];
|
16 |
+
$cartproid = $postData['diq'];
|
17 |
+
$carrier = $postData['carname'];
|
18 |
+
$dest = $postData['dest'];
|
19 |
+
$quoteid = $postData['qtid'];
|
20 |
+
$days = $postData['days'];
|
21 |
+
$grandship = $postData['grandship'];
|
22 |
+
$rateid = $postData['rateid'];
|
23 |
+
if($quoteid == NULL) {
|
24 |
+
$session = Mage::getSingleton('checkout/session');
|
25 |
+
$quoteid = $session->getQuoteId();
|
26 |
+
}
|
27 |
+
|
28 |
+
$resource = Mage::getSingleton('core/resource');
|
29 |
+
$writeConnection = $resource->getConnection('core_write');
|
30 |
+
$tableNamep = $resource->getTableName('brst_freight_shipping');
|
31 |
+
$select = "Select * from $tableNamep where product_id='$cartproid' AND quote_id='$quoteid'";
|
32 |
+
$qry = $writeConnection->query($select);
|
33 |
+
$product_info = $qry->fetchAll();
|
34 |
+
//echo "<pre>";print_r($product_info);exit;
|
35 |
+
if($product_info == NULL) {
|
36 |
+
$query = "INSERT INTO ".$tableNamep." (quote_id,product_id,shipping_charge,carrier_name,final_dest,rateid,days,grandship,mark) VALUES ('$quoteid','$cartproid','$freight_price','$carrier','$dest','$rateid','$days','$grandship','1')";
|
37 |
+
$writeConnection->query($query);
|
38 |
+
} else {
|
39 |
+
$rowid = $product_info[0]['id'];
|
40 |
+
$query = "UPDATE `$tableNamep` SET shipping_charge='$freight_price',carrier_name='$carrier', final_dest='$dest',rateid='$rateid',days='$days',grandship = '$grandship' where id=$rowid";
|
41 |
+
$writeConnection->query($query);
|
42 |
+
}
|
43 |
+
|
44 |
+
// $quote = Mage::getSingleton('checkout/session')->getQuote();
|
45 |
+
// foreach($quote->getAllVisibleItems() as $quote_item) {
|
46 |
+
// $product = Mage::getModel('catalog/product')->load($quote_item->getProductId());
|
47 |
+
// $productData = $product->getData();
|
48 |
+
// $productsku = $product->getSku();
|
49 |
+
// $productprice = $product->getPrice();
|
50 |
+
// $productid = $product->getId();
|
51 |
+
//
|
52 |
+
// if($productid == $cartproid) {
|
53 |
+
// $new_price = $freight_price + $productprice;
|
54 |
+
// $orig_price = $quote_item->getOriginalPrice();
|
55 |
+
// //$new_price = $orig_price;
|
56 |
+
// $quote_item->setOriginalCustomPrice($new_price);
|
57 |
+
// $quote_item->setCustomPrice($new_price);
|
58 |
+
// }
|
59 |
+
// }
|
60 |
+
//
|
61 |
+
// Mage::register('basket_observer_executed', true);
|
62 |
+
//
|
63 |
+
// $quote->save();
|
64 |
+
// $quote->setTotalsCollectedFlag(false)->collectTotals();
|
65 |
+
}
|
66 |
+
public function mynofunAction() {
|
67 |
+
$postData = $this->getRequest()->getPost();
|
68 |
+
//echo "<pre>";print_r($postData);exit;
|
69 |
+
|
70 |
+
$freight_price = $postData['val'];
|
71 |
+
$cartproid = $postData['diq'];
|
72 |
+
$carrier = $postData['carname'];
|
73 |
+
$dest = $postData['dest'];
|
74 |
+
$quoteid = $postData['qtid'];
|
75 |
+
$rateid = $postData['rateid'];
|
76 |
+
if($quoteid == NULL) {
|
77 |
+
$session = Mage::getSingleton('checkout/session');
|
78 |
+
$quoteid = $session->getQuoteId();
|
79 |
+
}
|
80 |
+
|
81 |
+
$resource = Mage::getSingleton('core/resource');
|
82 |
+
$writeConnection = $resource->getConnection('core_write');
|
83 |
+
$tableNamep = $resource->getTableName('brst_freight_shipping');
|
84 |
+
$select = "Select * from $tableNamep where product_id='$cartproid' AND quote_id='$quoteid' AND mark = '1'";
|
85 |
+
$qry = $writeConnection->query($select);
|
86 |
+
$product_info = $qry->fetchAll();
|
87 |
+
//echo "<pre>";print_r($product_info);exit;
|
88 |
+
if($product_info == NULL) {
|
89 |
+
$query = "INSERT INTO ".$tableNamep." (quote_id,product_id,shipping_charge,carrier_name,final_dest,rateid,mark) VALUES ('$quoteid','$cartproid','$freight_price','$carrier','$dest','$rateid','1')";
|
90 |
+
$writeConnection->query($query);
|
91 |
+
}
|
92 |
+
else {
|
93 |
+
$rowid = $product_info[0]['id'];
|
94 |
+
$query = "UPDATE `$tableNamep` SET shipping_charge='$freight_price',carrier_name='$carrier', final_dest='$dest',rateid='$rateid' where id=$rowid AND mark = '1'";
|
95 |
+
$writeConnection->query($query);
|
96 |
+
}
|
97 |
+
|
98 |
+
// $quote = Mage::getSingleton('checkout/session')->getQuote();
|
99 |
+
// foreach($quote->getAllVisibleItems() as $quote_item) {
|
100 |
+
// $product = Mage::getModel('catalog/product')->load($quote_item->getProductId());
|
101 |
+
// $productData = $product->getData();
|
102 |
+
// $productsku = $product->getSku();
|
103 |
+
// $productprice = $product->getPrice();
|
104 |
+
// $productid = $product->getId();
|
105 |
+
//
|
106 |
+
// if($productid == $cartproid) {
|
107 |
+
// $new_price = $freight_price + $productprice;
|
108 |
+
// $orig_price = $quote_item->getOriginalPrice();
|
109 |
+
// //$new_price = $orig_price;
|
110 |
+
// $quote_item->setOriginalCustomPrice($new_price);
|
111 |
+
// $quote_item->setCustomPrice($new_price);
|
112 |
+
// }
|
113 |
+
// }
|
114 |
+
//
|
115 |
+
// Mage::register('basket_observer_executed', true);
|
116 |
+
//
|
117 |
+
// $quote->save();
|
118 |
+
// $quote->setTotalsCollectedFlag(false)->collectTotals();
|
119 |
+
}
|
120 |
+
public function saveAction(){
|
121 |
+
|
122 |
+
$postData = $this->getRequest()->getPost();
|
123 |
+
//echo "<pre>";print_r($postData);exit;
|
124 |
+
|
125 |
+
$freight_price = $postData['val'];
|
126 |
+
$cartproid = $postData['diq'];
|
127 |
+
$quoteid = $postData['qtid'];
|
128 |
+
$order_id = $postData['order_id'];
|
129 |
+
$order = Mage::getModel('sales/order')->load(31);
|
130 |
+
$shippingId = $order->getShippingAddress()->getId();
|
131 |
+
$address = Mage::getModel('sales/order_address')->load($shippingId);
|
132 |
+
echo $quote = $order->getQuote();
|
133 |
+
$address->setGrandTotal($freight_price);
|
134 |
+
$address->setBaseGrandTotal($freight_price);
|
135 |
+
//$postData = $this->getRequest()->getPost();
|
136 |
+
|
137 |
+
//echo $_GET['var'] = $postData['val'];
|
138 |
+
//echo $_GET['diq'] = $postData['diq'];
|
139 |
+
//echo $hello = $_GET['var'];
|
140 |
+
//$make = explode(" ,",$hello);
|
141 |
+
//print_r($make);
|
142 |
+
//die('stop');
|
143 |
+
|
144 |
+
/* $resource = Mage::getSingleton('core/resource');
|
145 |
+
$writeConnection = $resource->getConnection('core_read');
|
146 |
+
$tableNamep = $resource->getTableName('sales_flat_order');
|
147 |
+
$queryp = 'SELECT * FROM ' . $tableNamep. ' WHERE entity_id = ' . $ware_id ;
|
148 |
+
$results = $writeConnection->fetchAll($queryp);
|
149 |
+
echo '<pre>'; print_r($results); echo '</pre>'; */
|
150 |
+
|
151 |
+
}
|
152 |
+
public function rowAction(){
|
153 |
+
|
154 |
+
echo "this is another function";
|
155 |
+
|
156 |
+
|
157 |
+
}
|
158 |
+
|
159 |
+
|
160 |
+
}
|
app/code/local/Freightcenters/Freight/controllers/IndexController.php@14Aug
ADDED
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Freightcenters_Freight_IndexController extends Mage_Checkout_Controller_Action{
|
3 |
+
public function newindexAction(){
|
4 |
+
die('hello');
|
5 |
+
//// $bla = Mage::getSingleton('fee/index');
|
6 |
+
//$bla->setMsg("Thank You for your visit!");
|
7 |
+
//$this->loadLayout();
|
8 |
+
//$this->renderLayout();
|
9 |
+
|
10 |
+
}
|
11 |
+
public function myfunAction() {
|
12 |
+
$postData = $this->getRequest()->getPost();
|
13 |
+
//echo "<pre>";print_r($postData);exit;
|
14 |
+
|
15 |
+
$freight_price = $postData['val'];
|
16 |
+
$cartproid = $postData['diq'];
|
17 |
+
$carrier = $postData['carname'];
|
18 |
+
$dest = $postData['dest'];
|
19 |
+
$quoteid = $postData['qtid'];
|
20 |
+
$days = $postData['days'];
|
21 |
+
$grandship = $postData['grandship'];
|
22 |
+
$rateid = $postData['rateid'];
|
23 |
+
if($quoteid == NULL) {
|
24 |
+
$session = Mage::getSingleton('checkout/session');
|
25 |
+
$quoteid = $session->getQuoteId();
|
26 |
+
}
|
27 |
+
|
28 |
+
$resource = Mage::getSingleton('core/resource');
|
29 |
+
$writeConnection = $resource->getConnection('core_write');
|
30 |
+
$tableNamep = $resource->getTableName('brst_freight_shipping');
|
31 |
+
$select = "Select * from $tableNamep where product_id='$cartproid' AND quote_id='$quoteid'";
|
32 |
+
$qry = $writeConnection->query($select);
|
33 |
+
$product_info = $qry->fetchAll();
|
34 |
+
//echo "<pre>";print_r($product_info);exit;
|
35 |
+
if($product_info == NULL) {
|
36 |
+
$query = "INSERT INTO ".$tableNamep." (quote_id,product_id,shipping_charge,carrier_name,final_dest,rateid,days,grandship,mark) VALUES ('$quoteid','$cartproid','$freight_price','$carrier','$dest','$rateid','$days','$grandship','1')";
|
37 |
+
$writeConnection->query($query);
|
38 |
+
} else {
|
39 |
+
$rowid = $product_info[0]['id'];
|
40 |
+
$query = "UPDATE `$tableNamep` SET shipping_charge='$freight_price',carrier_name='$carrier', final_dest='$dest',rateid='$rateid',days='$days',grandship = '$grandship' where id=$rowid";
|
41 |
+
$writeConnection->query($query);
|
42 |
+
}
|
43 |
+
|
44 |
+
// $quote = Mage::getSingleton('checkout/session')->getQuote();
|
45 |
+
// foreach($quote->getAllVisibleItems() as $quote_item) {
|
46 |
+
// $product = Mage::getModel('catalog/product')->load($quote_item->getProductId());
|
47 |
+
// $productData = $product->getData();
|
48 |
+
// $productsku = $product->getSku();
|
49 |
+
// $productprice = $product->getPrice();
|
50 |
+
// $productid = $product->getId();
|
51 |
+
//
|
52 |
+
// if($productid == $cartproid) {
|
53 |
+
// $new_price = $freight_price + $productprice;
|
54 |
+
// $orig_price = $quote_item->getOriginalPrice();
|
55 |
+
// //$new_price = $orig_price;
|
56 |
+
// $quote_item->setOriginalCustomPrice($new_price);
|
57 |
+
// $quote_item->setCustomPrice($new_price);
|
58 |
+
// }
|
59 |
+
// }
|
60 |
+
//
|
61 |
+
// Mage::register('basket_observer_executed', true);
|
62 |
+
//
|
63 |
+
// $quote->save();
|
64 |
+
// $quote->setTotalsCollectedFlag(false)->collectTotals();
|
65 |
+
}
|
66 |
+
public function mynofunAction() {
|
67 |
+
$postData = $this->getRequest()->getPost();
|
68 |
+
//echo "<pre>";print_r($postData);exit;
|
69 |
+
|
70 |
+
$freight_price = $postData['val'];
|
71 |
+
$cartproid = $postData['diq'];
|
72 |
+
$carrier = $postData['carname'];
|
73 |
+
$dest = $postData['dest'];
|
74 |
+
$quoteid = $postData['qtid'];
|
75 |
+
$rateid = $postData['rateid'];
|
76 |
+
if($quoteid == NULL) {
|
77 |
+
$session = Mage::getSingleton('checkout/session');
|
78 |
+
$quoteid = $session->getQuoteId();
|
79 |
+
}
|
80 |
+
|
81 |
+
$resource = Mage::getSingleton('core/resource');
|
82 |
+
$writeConnection = $resource->getConnection('core_write');
|
83 |
+
$tableNamep = $resource->getTableName('brst_freight_shipping');
|
84 |
+
$select = "Select * from $tableNamep where product_id='$cartproid' AND quote_id='$quoteid'";
|
85 |
+
$qry = $writeConnection->query($select);
|
86 |
+
$product_info = $qry->fetchAll();
|
87 |
+
//echo "<pre>";print_r($product_info);exit;
|
88 |
+
// if($product_info == NULL) {
|
89 |
+
$query = "INSERT INTO ".$tableNamep." (quote_id,product_id,shipping_charge,carrier_name,final_dest,rateid,mark) VALUES ('$quoteid','$cartproid','$freight_price','$carrier','$dest','$rateid','1')";
|
90 |
+
$writeConnection->query($query);
|
91 |
+
// }
|
92 |
+
//else {
|
93 |
+
// $rowid = $product_info[0]['id'];
|
94 |
+
// $query = "UPDATE `$tableNamep` SET shipping_charge='$freight_price',carrier_name='$carrier', final_dest='$dest',rateid='$rateid' where id=$rowid";
|
95 |
+
// $writeConnection->query($query);
|
96 |
+
// }
|
97 |
+
|
98 |
+
// $quote = Mage::getSingleton('checkout/session')->getQuote();
|
99 |
+
// foreach($quote->getAllVisibleItems() as $quote_item) {
|
100 |
+
// $product = Mage::getModel('catalog/product')->load($quote_item->getProductId());
|
101 |
+
// $productData = $product->getData();
|
102 |
+
// $productsku = $product->getSku();
|
103 |
+
// $productprice = $product->getPrice();
|
104 |
+
// $productid = $product->getId();
|
105 |
+
//
|
106 |
+
// if($productid == $cartproid) {
|
107 |
+
// $new_price = $freight_price + $productprice;
|
108 |
+
// $orig_price = $quote_item->getOriginalPrice();
|
109 |
+
// //$new_price = $orig_price;
|
110 |
+
// $quote_item->setOriginalCustomPrice($new_price);
|
111 |
+
// $quote_item->setCustomPrice($new_price);
|
112 |
+
// }
|
113 |
+
// }
|
114 |
+
//
|
115 |
+
// Mage::register('basket_observer_executed', true);
|
116 |
+
//
|
117 |
+
// $quote->save();
|
118 |
+
// $quote->setTotalsCollectedFlag(false)->collectTotals();
|
119 |
+
}
|
120 |
+
public function saveAction(){
|
121 |
+
|
122 |
+
$postData = $this->getRequest()->getPost();
|
123 |
+
//echo "<pre>";print_r($postData);exit;
|
124 |
+
|
125 |
+
$freight_price = $postData['val'];
|
126 |
+
$cartproid = $postData['diq'];
|
127 |
+
$quoteid = $postData['qtid'];
|
128 |
+
$order_id = $postData['order_id'];
|
129 |
+
$order = Mage::getModel('sales/order')->load(31);
|
130 |
+
$shippingId = $order->getShippingAddress()->getId();
|
131 |
+
$address = Mage::getModel('sales/order_address')->load($shippingId);
|
132 |
+
echo $quote = $order->getQuote();
|
133 |
+
$address->setGrandTotal($freight_price);
|
134 |
+
$address->setBaseGrandTotal($freight_price);
|
135 |
+
//$postData = $this->getRequest()->getPost();
|
136 |
+
|
137 |
+
//echo $_GET['var'] = $postData['val'];
|
138 |
+
//echo $_GET['diq'] = $postData['diq'];
|
139 |
+
//echo $hello = $_GET['var'];
|
140 |
+
//$make = explode(" ,",$hello);
|
141 |
+
//print_r($make);
|
142 |
+
//die('stop');
|
143 |
+
|
144 |
+
/* $resource = Mage::getSingleton('core/resource');
|
145 |
+
$writeConnection = $resource->getConnection('core_read');
|
146 |
+
$tableNamep = $resource->getTableName('sales_flat_order');
|
147 |
+
$queryp = 'SELECT * FROM ' . $tableNamep. ' WHERE entity_id = ' . $ware_id ;
|
148 |
+
$results = $writeConnection->fetchAll($queryp);
|
149 |
+
echo '<pre>'; print_r($results); echo '</pre>'; */
|
150 |
+
|
151 |
+
}
|
152 |
+
public function rowAction(){
|
153 |
+
|
154 |
+
echo "this is another function";
|
155 |
+
|
156 |
+
|
157 |
+
}
|
158 |
+
|
159 |
+
|
160 |
+
}
|
app/code/local/Freightcenters/Freight/controllers/IndexController.php@20June
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Freightcenters_Freight_IndexController extends Mage_Checkout_Controller_Action{
|
3 |
+
public function newindexAction(){
|
4 |
+
die('hello');
|
5 |
+
//// $bla = Mage::getSingleton('fee/index');
|
6 |
+
//$bla->setMsg("Thank You for your visit!");
|
7 |
+
//$this->loadLayout();
|
8 |
+
//$this->renderLayout();
|
9 |
+
|
10 |
+
}
|
11 |
+
public function myfunAction() {
|
12 |
+
$postData = $this->getRequest()->getPost();
|
13 |
+
//echo "<pre>";print_r($postData);exit;
|
14 |
+
|
15 |
+
$freight_price = $postData['val'];
|
16 |
+
$cartproid = $postData['diq'];
|
17 |
+
$carrier = $postData['carname'];
|
18 |
+
$quoteid = $postData['qtid'];
|
19 |
+
if($quoteid == NULL) {
|
20 |
+
$session = Mage::getSingleton('checkout/session');
|
21 |
+
$quoteid = $session->getQuoteId();
|
22 |
+
}
|
23 |
+
|
24 |
+
$resource = Mage::getSingleton('core/resource');
|
25 |
+
$writeConnection = $resource->getConnection('core_write');
|
26 |
+
$tableNamep = $resource->getTableName('brst_freight_shipping');
|
27 |
+
$select = "Select * from $tableNamep where product_id='$cartproid' AND quote_id='$quoteid'";
|
28 |
+
$qry = $writeConnection->query($select);
|
29 |
+
$product_info = $qry->fetchAll();
|
30 |
+
//echo "<pre>";print_r($product_info);exit;
|
31 |
+
if($product_info == NULL) {
|
32 |
+
$query = "INSERT INTO ".$tableNamep." (quote_id,product_id,shipping_charge,carrier_name) VALUES ('$quoteid','$cartproid','$freight_price','$carrier')";
|
33 |
+
$writeConnection->query($query);
|
34 |
+
} else {
|
35 |
+
$rowid = $product_info[0]['id'];
|
36 |
+
$query = "UPDATE `$tableNamep` SET shipping_charge='$freight_price',carrier_name='$carrier' where id=$rowid";
|
37 |
+
$writeConnection->query($query);
|
38 |
+
}
|
39 |
+
|
40 |
+
// $quote = Mage::getSingleton('checkout/session')->getQuote();
|
41 |
+
// foreach($quote->getAllVisibleItems() as $quote_item) {
|
42 |
+
// $product = Mage::getModel('catalog/product')->load($quote_item->getProductId());
|
43 |
+
// $productData = $product->getData();
|
44 |
+
// $productsku = $product->getSku();
|
45 |
+
// $productprice = $product->getPrice();
|
46 |
+
// $productid = $product->getId();
|
47 |
+
//
|
48 |
+
// if($productid == $cartproid) {
|
49 |
+
// $new_price = $freight_price + $productprice;
|
50 |
+
// $orig_price = $quote_item->getOriginalPrice();
|
51 |
+
// //$new_price = $orig_price;
|
52 |
+
// $quote_item->setOriginalCustomPrice($new_price);
|
53 |
+
// $quote_item->setCustomPrice($new_price);
|
54 |
+
// }
|
55 |
+
// }
|
56 |
+
//
|
57 |
+
// Mage::register('basket_observer_executed', true);
|
58 |
+
//
|
59 |
+
// $quote->save();
|
60 |
+
// $quote->setTotalsCollectedFlag(false)->collectTotals();
|
61 |
+
}
|
62 |
+
public function saveAction(){
|
63 |
+
|
64 |
+
$ware_id = $_GET['id'];
|
65 |
+
//$postData = $this->getRequest()->getPost();
|
66 |
+
|
67 |
+
//echo $_GET['var'] = $postData['val'];
|
68 |
+
//echo $_GET['diq'] = $postData['diq'];
|
69 |
+
//echo $hello = $_GET['var'];
|
70 |
+
//$make = explode(" ,",$hello);
|
71 |
+
//print_r($make);
|
72 |
+
//die('stop');
|
73 |
+
|
74 |
+
$resource = Mage::getSingleton('core/resource');
|
75 |
+
$writeConnection = $resource->getConnection('core_read');
|
76 |
+
$tableNamep = $resource->getTableName('sales_flat_order');
|
77 |
+
$queryp = 'SELECT * FROM ' . $tableNamep. ' WHERE entity_id = ' . $ware_id ;
|
78 |
+
$results = $writeConnection->fetchAll($queryp);
|
79 |
+
echo '<pre>'; print_r($results); echo '</pre>';
|
80 |
+
|
81 |
+
}
|
82 |
+
public function rowAction(){
|
83 |
+
|
84 |
+
echo "this is another function";
|
85 |
+
|
86 |
+
|
87 |
+
}
|
88 |
+
|
89 |
+
|
90 |
+
}
|
app/code/local/Freightcenters/Freight/controllers/IndexController_18thJune.php
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Freightcenters_Freight_IndexController extends Mage_Checkout_Controller_Action{
|
3 |
+
public function newindexAction(){
|
4 |
+
die('hello');
|
5 |
+
//// $bla = Mage::getSingleton('fee/index');
|
6 |
+
//$bla->setMsg("Thank You for your visit!");
|
7 |
+
//$this->loadLayout();
|
8 |
+
//$this->renderLayout();
|
9 |
+
|
10 |
+
}
|
11 |
+
public function myfunAction() {
|
12 |
+
$postData = $this->getRequest()->getPost();
|
13 |
+
//echo "<pre>";print_r($postData);exit;
|
14 |
+
|
15 |
+
$freight_price = $postData['val'];
|
16 |
+
$cartproid = $postData['diq'];
|
17 |
+
$carrier = $postData['carname'];
|
18 |
+
$quoteid = $postData['qtid'];
|
19 |
+
if($quoteid == NULL) {
|
20 |
+
$session = Mage::getSingleton('checkout/session');
|
21 |
+
$quoteid = $session->getQuoteId();
|
22 |
+
}
|
23 |
+
|
24 |
+
$resource = Mage::getSingleton('core/resource');
|
25 |
+
$writeConnection = $resource->getConnection('core_write');
|
26 |
+
$tableNamep = $resource->getTableName('brst_freight_shipping');
|
27 |
+
$select = "Select * from $tableNamep where product_id='$cartproid' AND quote_id='$quoteid'";
|
28 |
+
$qry = $writeConnection->query($select);
|
29 |
+
$product_info = $qry->fetchAll();
|
30 |
+
//echo "<pre>";print_r($product_info);exit;
|
31 |
+
if($product_info == NULL) {
|
32 |
+
$query = "INSERT INTO ".$tableNamep." (quote_id,product_id,shipping_charge,carrier_name) VALUES ('$quoteid','$cartproid','$freight_price','$carrier')";
|
33 |
+
$writeConnection->query($query);
|
34 |
+
} else {
|
35 |
+
$rowid = $product_info[0]['id'];
|
36 |
+
$query = "UPDATE `$tableNamep` SET shipping_charge='$freight_price',carrier_name='$carrier' where id=$rowid";
|
37 |
+
$writeConnection->query($query);
|
38 |
+
}
|
39 |
+
|
40 |
+
// $quote = Mage::getSingleton('checkout/session')->getQuote();
|
41 |
+
// foreach($quote->getAllVisibleItems() as $quote_item) {
|
42 |
+
// $product = Mage::getModel('catalog/product')->load($quote_item->getProductId());
|
43 |
+
// $productData = $product->getData();
|
44 |
+
// $productsku = $product->getSku();
|
45 |
+
// $productprice = $product->getPrice();
|
46 |
+
// $productid = $product->getId();
|
47 |
+
//
|
48 |
+
// if($productid == $cartproid) {
|
49 |
+
// $new_price = $freight_price + $productprice;
|
50 |
+
// $orig_price = $quote_item->getOriginalPrice();
|
51 |
+
// //$new_price = $orig_price;
|
52 |
+
// $quote_item->setOriginalCustomPrice($new_price);
|
53 |
+
// $quote_item->setCustomPrice($new_price);
|
54 |
+
// }
|
55 |
+
// }
|
56 |
+
//
|
57 |
+
// Mage::register('basket_observer_executed', true);
|
58 |
+
//
|
59 |
+
// $quote->save();
|
60 |
+
// $quote->setTotalsCollectedFlag(false)->collectTotals();
|
61 |
+
}
|
62 |
+
public function saveAction(){
|
63 |
+
|
64 |
+
$ware_id = $_GET['id'];
|
65 |
+
//$postData = $this->getRequest()->getPost();
|
66 |
+
|
67 |
+
//echo $_GET['var'] = $postData['val'];
|
68 |
+
//echo $_GET['diq'] = $postData['diq'];
|
69 |
+
//echo $hello = $_GET['var'];
|
70 |
+
//$make = explode(" ,",$hello);
|
71 |
+
//print_r($make);
|
72 |
+
//die('stop');
|
73 |
+
|
74 |
+
$resource = Mage::getSingleton('core/resource');
|
75 |
+
$writeConnection = $resource->getConnection('core_read');
|
76 |
+
$tableNamep = $resource->getTableName('sales_flat_order');
|
77 |
+
$queryp = 'SELECT * FROM ' . $tableNamep. ' WHERE entity_id = ' . $ware_id ;
|
78 |
+
$results = $writeConnection->fetchAll($queryp);
|
79 |
+
echo '<pre>'; print_r($results); echo '</pre>';
|
80 |
+
|
81 |
+
}
|
82 |
+
public function rowAction(){
|
83 |
+
|
84 |
+
echo "this is another function";
|
85 |
+
|
86 |
+
|
87 |
+
}
|
88 |
+
|
89 |
+
|
90 |
+
}
|
app/code/local/Freightcenters/Freight/etc/config.xml
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Freightcenters_Freight>
|
5 |
+
<version>1.0.1</version>
|
6 |
+
</Freightcenters_Freight>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<arithmetic>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Freightcenters_Freight</module>
|
14 |
+
<frontName>freight</frontName>
|
15 |
+
</args>
|
16 |
+
</arithmetic>
|
17 |
+
</routers>
|
18 |
+
</frontend>
|
19 |
+
</config>
|
app/code/local/Freightcenters/Freight/etc/config.xml@23June
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Freightcenters_Freight>
|
5 |
+
<version>1.0.1</version>
|
6 |
+
</Freightcenters_Freight>
|
7 |
+
</modules>
|
8 |
+
|
9 |
+
<frontend>
|
10 |
+
<routers>
|
11 |
+
<arithmetic>
|
12 |
+
<use>standard</use>
|
13 |
+
<args>
|
14 |
+
<module>Freightcenters_Freight</module>
|
15 |
+
<frontName>freight</frontName>
|
16 |
+
</args>
|
17 |
+
</arithmetic>
|
18 |
+
</routers>
|
19 |
+
</frontend>
|
20 |
+
</config>
|
app/code/local/Freightcenters/Freight/sql/freightcenters_freight_setup/mysql4-install-1.0.0.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/* delete tables from database if exists */
|
4 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
5 |
+
$carriers_table = "Drop table if exists `brst_freight_shipping`";
|
6 |
+
$connection->query($carriers_table);
|
7 |
+
|
8 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
9 |
+
$installer = $this;
|
10 |
+
$installer->startSetup();
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Create table 'brst_freight_shipping'
|
14 |
+
*/
|
15 |
+
$table = $installer->getConnection()
|
16 |
+
// The following call to getTable('foo_bar/baz') will lookup the resource for foo_bar (foo_bar_mysql4), and look
|
17 |
+
// for a corresponding entity called baz. The table name in the XML is foo_bar_baz, so ths is what is created.
|
18 |
+
->newTable($installer->getTable('brst_freight_shipping'))
|
19 |
+
->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
20 |
+
'identity' => true,
|
21 |
+
'unsigned' => true,
|
22 |
+
'nullable' => false,
|
23 |
+
'primary' => true,
|
24 |
+
), 'ID')
|
25 |
+
->addColumn('product_id', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
26 |
+
'nullable' => false,
|
27 |
+
), 'Product Id')
|
28 |
+
->addColumn('shipping_charge', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
29 |
+
'nullable' => false,
|
30 |
+
), 'Shipping Charge')
|
31 |
+
->addColumn('quote_id', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
32 |
+
'nullable' => false,
|
33 |
+
), 'Quote Id')
|
34 |
+
->addColumn('carrier_name', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
35 |
+
'nullable' => false,
|
36 |
+
), 'Carrier Name')
|
37 |
+
->addColumn('bookingno', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
38 |
+
'nullable' => false,
|
39 |
+
), 'Booking No')
|
40 |
+
->addColumn('status', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
41 |
+
'nullable' => false,
|
42 |
+
), 'Status')
|
43 |
+
->addColumn('date_from', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
44 |
+
'nullable' => false,
|
45 |
+
), 'Date From')
|
46 |
+
->addColumn('date_to', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
47 |
+
'nullable' => false,
|
48 |
+
), 'Date TO')
|
49 |
+
->addColumn('final_dest', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
50 |
+
'nullable' => false,
|
51 |
+
), 'Final Destination');
|
52 |
+
->addColumn('rateid', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
|
53 |
+
'nullable' => false,
|
54 |
+
), 'RATEID');
|
55 |
+
|
56 |
+
$installer->getConnection()->createTable($table);
|
57 |
+
|
58 |
+
?>
|
app/code/local/Mage/Shipping/Block/Tracking/Ajax.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Mage_Shipping_Block_Tracking_Ajax extends Mage_Core_Block_Template
|
28 |
+
{
|
29 |
+
|
30 |
+
}
|
app/code/local/Mage/Shipping/Block/Tracking/Popup.php
ADDED
@@ -0,0 +1,269 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Mage_Shipping_Block_Tracking_Popup extends Mage_Core_Block_Template
|
28 |
+
{
|
29 |
+
/**
|
30 |
+
* @deprecated after 1.3.2.3
|
31 |
+
*/
|
32 |
+
protected $_track_id;
|
33 |
+
/**
|
34 |
+
* @deprecated after 1.3.2.3
|
35 |
+
*/
|
36 |
+
protected $_order_id;
|
37 |
+
/**
|
38 |
+
* @deprecated after 1.3.2.3
|
39 |
+
*/
|
40 |
+
protected $_ship_id;
|
41 |
+
|
42 |
+
/**
|
43 |
+
* @deprecated after 1.3.2.3
|
44 |
+
*/
|
45 |
+
public function setOrderId($oid)
|
46 |
+
{
|
47 |
+
return $this->setData('order_id', $oid);
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* @deprecated after 1.3.2.3
|
52 |
+
*/
|
53 |
+
public function getOrderId()
|
54 |
+
{
|
55 |
+
return $this->_getData('order_id');
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* @deprecated after 1.3.2.3
|
60 |
+
*/
|
61 |
+
public function setShipId($oid)
|
62 |
+
{
|
63 |
+
return $this->setData('ship_id', $oid);
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* @deprecated after 1.3.2.3
|
68 |
+
*/
|
69 |
+
public function getShipId()
|
70 |
+
{
|
71 |
+
return $this->_getData('ship_id');
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* @deprecated after 1.3.2.3
|
76 |
+
*/
|
77 |
+
public function setTrackId($tid='')
|
78 |
+
{
|
79 |
+
return $this->setData('track_id', $tid);
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* @deprecated after 1.3.2.3
|
84 |
+
*/
|
85 |
+
public function getTrackId()
|
86 |
+
{
|
87 |
+
return $this->_getData('track_id');
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* @deprecated after 1.4.0.0-alpha3
|
92 |
+
* Initialize order model instance
|
93 |
+
*
|
94 |
+
* @return Mage_Sales_Model_Order || false
|
95 |
+
*/
|
96 |
+
protected function _initOrder()
|
97 |
+
{
|
98 |
+
$order = Mage::getModel('sales/order')->load($this->getOrderId());
|
99 |
+
|
100 |
+
if (!$order->getId() || $this->getProtectCode() != $order->getProtectCode()) {
|
101 |
+
return false;
|
102 |
+
}
|
103 |
+
|
104 |
+
return $order;
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* @deprecated after 1.4.0.0-alpha3
|
109 |
+
* Initialize ship model instance
|
110 |
+
*
|
111 |
+
* @return Mage_Sales_Model_Order_Shipment || false
|
112 |
+
*/
|
113 |
+
protected function _initShipment()
|
114 |
+
{
|
115 |
+
$ship = Mage::getModel('sales/order_shipment')->load($this->getShipId());
|
116 |
+
|
117 |
+
if (!$ship->getEntityId() || $this->getProtectCode() != $ship->getProtectCode()) {
|
118 |
+
return false;
|
119 |
+
}
|
120 |
+
|
121 |
+
return $ship;
|
122 |
+
}
|
123 |
+
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Retrieve array of tracking info
|
127 |
+
*
|
128 |
+
* @return array
|
129 |
+
*/
|
130 |
+
public function getTrackingInfo()
|
131 |
+
{
|
132 |
+
/* @var $info Mage_Shipping_Model_Info */
|
133 |
+
$info = Mage::registry('current_shipping_info');
|
134 |
+
|
135 |
+
return $info->getTrackingInfo();
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* @deprecated after 1.4.0.0-alpha3
|
140 |
+
* Retrieve all tracking by orders id
|
141 |
+
*
|
142 |
+
* @return array
|
143 |
+
*/
|
144 |
+
public function getTrackingInfoByOrder()
|
145 |
+
{
|
146 |
+
$shipTrack = array();
|
147 |
+
if ($order = $this->_initOrder()) {
|
148 |
+
$shipments = $order->getShipmentsCollection();
|
149 |
+
foreach ($shipments as $shipment){
|
150 |
+
$increment_id = $shipment->getIncrementId();
|
151 |
+
$tracks = $shipment->getTracksCollection();
|
152 |
+
|
153 |
+
$trackingInfos=array();
|
154 |
+
foreach ($tracks as $track){
|
155 |
+
$trackingInfos[] = $track->getNumberDetail();
|
156 |
+
}
|
157 |
+
$shipTrack[$increment_id] = $trackingInfos;
|
158 |
+
}
|
159 |
+
}
|
160 |
+
return $shipTrack;
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* @deprecated after 1.4.0.0-alpha3
|
165 |
+
* Retrieve all tracking by ship id
|
166 |
+
*
|
167 |
+
* @return array
|
168 |
+
*/
|
169 |
+
public function getTrackingInfoByShip()
|
170 |
+
{
|
171 |
+
$shipTrack = array();
|
172 |
+
if ($shipment = $this->_initShipment()) {
|
173 |
+
$increment_id = $shipment->getIncrementId();
|
174 |
+
$tracks = $shipment->getTracksCollection();
|
175 |
+
|
176 |
+
$trackingInfos=array();
|
177 |
+
foreach ($tracks as $track){
|
178 |
+
$trackingInfos[] = $track->getNumberDetail();
|
179 |
+
}
|
180 |
+
$shipTrack[$increment_id] = $trackingInfos;
|
181 |
+
|
182 |
+
}
|
183 |
+
return $shipTrack;
|
184 |
+
}
|
185 |
+
|
186 |
+
/**
|
187 |
+
* @deprecated after 1.4.0.0-alpha3
|
188 |
+
* Retrieve tracking by tracking entity id
|
189 |
+
*
|
190 |
+
* @return array
|
191 |
+
*/
|
192 |
+
public function getTrackingInfoByTrackId()
|
193 |
+
{
|
194 |
+
$track = Mage::getModel('sales/order_shipment_track')->load($this->getTrackId());
|
195 |
+
if ($this->getProtectCode() == $track->getProtectCode()) {
|
196 |
+
return array(array($track->getNumberDetail()));
|
197 |
+
}
|
198 |
+
return array(array());
|
199 |
+
}
|
200 |
+
|
201 |
+
/**
|
202 |
+
* Format given date and time in current locale without changing timezone
|
203 |
+
*
|
204 |
+
* @param string $date
|
205 |
+
* @param string $time
|
206 |
+
* @return string
|
207 |
+
*/
|
208 |
+
public function formatDeliveryDateTime($date, $time)
|
209 |
+
{
|
210 |
+
return $this->formatDeliveryDate($date) . ' ' . $this->formatDeliveryTime($time);
|
211 |
+
}
|
212 |
+
|
213 |
+
/**
|
214 |
+
* Format given date in current locale without changing timezone
|
215 |
+
*
|
216 |
+
* @param string $date
|
217 |
+
* @return string
|
218 |
+
*/
|
219 |
+
public function formatDeliveryDate($date)
|
220 |
+
{
|
221 |
+
/* @var $locale Mage_Core_Model_Locale */
|
222 |
+
$locale = Mage::app()->getLocale();
|
223 |
+
$format = $locale->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
|
224 |
+
return $locale->date(strtotime($date), Zend_Date::TIMESTAMP, null, false)
|
225 |
+
->toString($format);
|
226 |
+
}
|
227 |
+
|
228 |
+
/**
|
229 |
+
* Format given time [+ date] in current locale without changing timezone
|
230 |
+
*
|
231 |
+
* @param string $time
|
232 |
+
* @param string $date
|
233 |
+
* @return string
|
234 |
+
*/
|
235 |
+
public function formatDeliveryTime($time, $date = null)
|
236 |
+
{
|
237 |
+
if (!empty($date)) {
|
238 |
+
$time = $date . ' ' . $time;
|
239 |
+
}
|
240 |
+
|
241 |
+
/* @var $locale Mage_Core_Model_Locale */
|
242 |
+
$locale = Mage::app()->getLocale();
|
243 |
+
|
244 |
+
$format = $locale->getTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
|
245 |
+
return $locale->date(strtotime($time), Zend_Date::TIMESTAMP, null, false)
|
246 |
+
->toString($format);
|
247 |
+
}
|
248 |
+
|
249 |
+
/**
|
250 |
+
* Is 'contact us' option enabled?
|
251 |
+
*
|
252 |
+
* @return boolean
|
253 |
+
*/
|
254 |
+
public function getContactUsEnabled()
|
255 |
+
{
|
256 |
+
return (bool) Mage::getStoreConfig('contacts/contacts/enabled');
|
257 |
+
}
|
258 |
+
|
259 |
+
public function getStoreSupportEmail()
|
260 |
+
{
|
261 |
+
return Mage::getStoreConfig('trans_email/ident_support/email');
|
262 |
+
}
|
263 |
+
|
264 |
+
public function getContactUs()
|
265 |
+
{
|
266 |
+
return $this->getUrl('contacts');
|
267 |
+
}
|
268 |
+
|
269 |
+
}
|
app/code/local/Mage/Shipping/Exception.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
class Mage_Shipping_Exception extends Zend_Exception
|
29 |
+
{
|
30 |
+
|
31 |
+
}
|
app/code/local/Mage/Shipping/Helper/Data.php
ADDED
@@ -0,0 +1,162 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Shipping data helper
|
29 |
+
*/
|
30 |
+
class Mage_Shipping_Helper_Data extends Mage_Core_Helper_Abstract
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* Allowed hash keys
|
34 |
+
*
|
35 |
+
* @var array
|
36 |
+
*/
|
37 |
+
protected $_allowedHashKeys = array('ship_id', 'order_id', 'track_id');
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Decode url hash
|
41 |
+
*
|
42 |
+
* @param string $hash
|
43 |
+
* @return array
|
44 |
+
*/
|
45 |
+
public function decodeTrackingHash($hash)
|
46 |
+
{
|
47 |
+
$hash = explode(':', Mage::helper('core')->urlDecode($hash));
|
48 |
+
if (count($hash) === 3 && in_array($hash[0], $this->_allowedHashKeys)) {
|
49 |
+
return array('key' => $hash[0], 'id' => (int)$hash[1], 'hash' => $hash[2]);
|
50 |
+
}
|
51 |
+
return array();
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Retrieve tracking url with params
|
56 |
+
*
|
57 |
+
* @deprecated the non-model usage
|
58 |
+
*
|
59 |
+
* @param string $key
|
60 |
+
* @param integer|Mage_Sales_Model_Order|Mage_Sales_Model_Order_Shipment|Mage_Sales_Model_Order_Shipment_Track $model
|
61 |
+
* @param string $method - option
|
62 |
+
* @return string
|
63 |
+
*/
|
64 |
+
protected function _getTrackingUrl($key, $model, $method = 'getId')
|
65 |
+
{
|
66 |
+
if (empty($model)) {
|
67 |
+
$param = array($key => ''); // @deprecated after 1.4.0.0-alpha3
|
68 |
+
} else if (!is_object($model)) {
|
69 |
+
$param = array($key => $model); // @deprecated after 1.4.0.0-alpha3
|
70 |
+
} else {
|
71 |
+
$param = array(
|
72 |
+
'hash' => Mage::helper('core')->urlEncode("{$key}:{$model->$method()}:{$model->getProtectCode()}")
|
73 |
+
);
|
74 |
+
}
|
75 |
+
$storeId = is_object($model) ? $model->getStoreId() : null;
|
76 |
+
$storeModel = Mage::app()->getStore($storeId);
|
77 |
+
return $storeModel->getUrl('shipping/tracking/popup', $param);
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* @deprecated after 1.4.0.0-alpha3
|
82 |
+
* Retrieve tracking pop up url by order id or object
|
83 |
+
*
|
84 |
+
* @param int|Mage_Sales_Model_Order $order
|
85 |
+
* @return string
|
86 |
+
*/
|
87 |
+
public function getTrackingPopUpUrlByOrderId($order = '')
|
88 |
+
{
|
89 |
+
if ($order && !is_object($order)) {
|
90 |
+
$order = Mage::getModel('sales/order')->load($order);
|
91 |
+
}
|
92 |
+
return $this->_getTrackingUrl('order_id', $order);
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* @deprecated after 1.4.0.0-alpha3
|
97 |
+
* Retrieve tracking pop up url by track id or object
|
98 |
+
*
|
99 |
+
* @param int|Mage_Sales_Model_Order_Shipment_Track $track
|
100 |
+
* @return string
|
101 |
+
*/
|
102 |
+
public function getTrackingPopUpUrlByTrackId($track = '')
|
103 |
+
{
|
104 |
+
if ($track && !is_object($track)) {
|
105 |
+
$track = Mage::getModel('sales/order_shipment_track')->load($track);
|
106 |
+
}
|
107 |
+
return $this->_getTrackingUrl('track_id', $track, 'getEntityId');
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* @deprecated after 1.4.0.0-alpha3
|
112 |
+
* Retrieve tracking pop up url by ship id or object
|
113 |
+
*
|
114 |
+
* @param int|Mage_Sales_Model_Order_Shipment $track
|
115 |
+
* @return string
|
116 |
+
*/
|
117 |
+
public function getTrackingPopUpUrlByShipId($ship = '')
|
118 |
+
{
|
119 |
+
if ($ship && !is_object($ship)) {
|
120 |
+
$ship = Mage::getModel('sales/order_shipment')->load($ship);
|
121 |
+
}
|
122 |
+
return $this->_getTrackingUrl('ship_id', $ship);
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Shipping tracking popup URL getter
|
127 |
+
*
|
128 |
+
* @param Mage_Sales_Model_Abstract $model
|
129 |
+
* @return string
|
130 |
+
*/
|
131 |
+
public function getTrackingPopupUrlBySalesModel($model)
|
132 |
+
{
|
133 |
+
if ($model instanceof Mage_Sales_Model_Order) {
|
134 |
+
return $this->_getTrackingUrl('order_id', $model);
|
135 |
+
} elseif ($model instanceof Mage_Sales_Model_Order_Shipment) {
|
136 |
+
return $this->_getTrackingUrl('ship_id', $model);
|
137 |
+
} elseif ($model instanceof Mage_Sales_Model_Order_Shipment_Track) {
|
138 |
+
return $this->_getTrackingUrl('track_id', $model, 'getEntityId');
|
139 |
+
}
|
140 |
+
return '';
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* Retrieve tracking ajax url
|
145 |
+
*
|
146 |
+
* @return string
|
147 |
+
*/
|
148 |
+
public function getTrackingAjaxUrl()
|
149 |
+
{
|
150 |
+
return $this->_getUrl('shipping/tracking/ajax');
|
151 |
+
}
|
152 |
+
|
153 |
+
public function isFreeMethod($method, $storeId = null)
|
154 |
+
{
|
155 |
+
$arr = explode('_', $method, 2);
|
156 |
+
if (!isset($arr[1])) {
|
157 |
+
return false;
|
158 |
+
}
|
159 |
+
$freeMethod = Mage::getStoreConfig('carriers/' . $arr[0] . '/free_method', $storeId);
|
160 |
+
return $freeMethod == $arr[1];
|
161 |
+
}
|
162 |
+
}
|
app/code/local/Mage/Shipping/Model/Carrier/Abstract.php
ADDED
@@ -0,0 +1,585 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
abstract class Mage_Shipping_Model_Carrier_Abstract extends Varien_Object
|
29 |
+
{
|
30 |
+
/**
|
31 |
+
* Carrier's code
|
32 |
+
*
|
33 |
+
* @var string
|
34 |
+
*/
|
35 |
+
protected $_code;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Rates result
|
39 |
+
*
|
40 |
+
* @var array|null
|
41 |
+
*/
|
42 |
+
protected $_rates;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Number of boxes in package
|
46 |
+
*
|
47 |
+
* @var int
|
48 |
+
*/
|
49 |
+
protected $_numBoxes = 1;
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Free Method config path
|
53 |
+
*
|
54 |
+
* @var string
|
55 |
+
*/
|
56 |
+
protected $_freeMethod = 'free_method';
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Whether this carrier has fixed rates calculation
|
60 |
+
*
|
61 |
+
* @var bool
|
62 |
+
*/
|
63 |
+
protected $_isFixed = false;
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Container types that could be customized
|
67 |
+
*
|
68 |
+
* @var array
|
69 |
+
*/
|
70 |
+
protected $_customizableContainerTypes = array();
|
71 |
+
|
72 |
+
const USA_COUNTRY_ID = 'US';
|
73 |
+
const CANADA_COUNTRY_ID = 'CA';
|
74 |
+
const MEXICO_COUNTRY_ID = 'MX';
|
75 |
+
|
76 |
+
const HANDLING_TYPE_PERCENT = 'P';
|
77 |
+
const HANDLING_TYPE_FIXED = 'F';
|
78 |
+
|
79 |
+
const HANDLING_ACTION_PERPACKAGE = 'P';
|
80 |
+
const HANDLING_ACTION_PERORDER = 'O';
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Fields that should be replaced in debug with '***'
|
84 |
+
*
|
85 |
+
* @var array
|
86 |
+
*/
|
87 |
+
protected $_debugReplacePrivateDataKeys = array();
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Retrieve information from carrier configuration
|
91 |
+
*
|
92 |
+
* @param string $field
|
93 |
+
* @return mixed
|
94 |
+
*/
|
95 |
+
public function getConfigData($field)
|
96 |
+
{
|
97 |
+
if (empty($this->_code)) {
|
98 |
+
return false;
|
99 |
+
}
|
100 |
+
$path = 'carriers/'.$this->_code.'/'.$field;
|
101 |
+
return Mage::getStoreConfig($path, $this->getStore());
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Retrieve config flag for store by field
|
106 |
+
*
|
107 |
+
* @param string $field
|
108 |
+
* @return bool
|
109 |
+
*/
|
110 |
+
public function getConfigFlag($field)
|
111 |
+
{
|
112 |
+
if (empty($this->_code)) {
|
113 |
+
return false;
|
114 |
+
}
|
115 |
+
$path = 'carriers/'.$this->_code.'/'.$field;
|
116 |
+
return Mage::getStoreConfigFlag($path, $this->getStore());
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Collect and get rates
|
121 |
+
*
|
122 |
+
* @abstract
|
123 |
+
* @param Mage_Shipping_Model_Rate_Request $request
|
124 |
+
* @return Mage_Shipping_Model_Rate_Result|bool|null
|
125 |
+
*/
|
126 |
+
abstract public function collectRates(Mage_Shipping_Model_Rate_Request $request);
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Do request to shipment
|
130 |
+
* Implementation must be in overridden method
|
131 |
+
*
|
132 |
+
* @param Mage_Shipping_Model_Shipment_Request $request
|
133 |
+
* @return Varien_Object
|
134 |
+
*/
|
135 |
+
public function requestToShipment(Mage_Shipping_Model_Shipment_Request $request)
|
136 |
+
{
|
137 |
+
return new Varien_Object();
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Do return of shipment
|
142 |
+
* Implementation must be in overridden method
|
143 |
+
*
|
144 |
+
* @param $request
|
145 |
+
* @return Varien_Object
|
146 |
+
*/
|
147 |
+
public function returnOfShipment($request)
|
148 |
+
{
|
149 |
+
return new Varien_Object();
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Return container types of carrier
|
154 |
+
*
|
155 |
+
* @param Varien_Object|null $params
|
156 |
+
* @return array
|
157 |
+
*/
|
158 |
+
public function getContainerTypes(Varien_Object $params = null)
|
159 |
+
{
|
160 |
+
return array();
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Get allowed containers of carrier
|
165 |
+
*
|
166 |
+
* @param Varien_Object|null $params
|
167 |
+
* @return array|bool
|
168 |
+
*/
|
169 |
+
protected function _getAllowedContainers(Varien_Object $params = null)
|
170 |
+
{
|
171 |
+
$containersAll = $this->getContainerTypesAll();
|
172 |
+
if (empty($containersAll)) {
|
173 |
+
return array();
|
174 |
+
}
|
175 |
+
if (empty($params)) {
|
176 |
+
return $containersAll;
|
177 |
+
}
|
178 |
+
$containersFilter = $this->getContainerTypesFilter();
|
179 |
+
$containersFiltered = array();
|
180 |
+
$method = $params->getMethod();
|
181 |
+
$countryShipper = $params->getCountryShipper();
|
182 |
+
$countryRecipient = $params->getCountryRecipient();
|
183 |
+
|
184 |
+
if (empty($containersFilter)) {
|
185 |
+
return $containersAll;
|
186 |
+
}
|
187 |
+
if (!$params || !$method || !$countryShipper || !$countryRecipient) {
|
188 |
+
return $containersAll;
|
189 |
+
}
|
190 |
+
|
191 |
+
if ($countryShipper == self::USA_COUNTRY_ID && $countryRecipient == self::USA_COUNTRY_ID) {
|
192 |
+
$direction = 'within_us';
|
193 |
+
} else if ($countryShipper == self::USA_COUNTRY_ID && $countryRecipient != self::USA_COUNTRY_ID) {
|
194 |
+
$direction = 'from_us';
|
195 |
+
} else {
|
196 |
+
return $containersAll;
|
197 |
+
}
|
198 |
+
|
199 |
+
foreach ($containersFilter as $dataItem) {
|
200 |
+
$containers = $dataItem['containers'];
|
201 |
+
$filters = $dataItem['filters'];
|
202 |
+
if (!empty($filters[$direction]['method'])
|
203 |
+
&& in_array($method, $filters[$direction]['method'])
|
204 |
+
) {
|
205 |
+
foreach ($containers as $container) {
|
206 |
+
if (!empty($containersAll[$container])) {
|
207 |
+
$containersFiltered[$container] = $containersAll[$container];
|
208 |
+
}
|
209 |
+
}
|
210 |
+
}
|
211 |
+
}
|
212 |
+
|
213 |
+
return !empty($containersFiltered) ? $containersFiltered : $containersAll;
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Get Container Types, that could be customized
|
218 |
+
*
|
219 |
+
* @return array
|
220 |
+
*/
|
221 |
+
public function getCustomizableContainerTypes()
|
222 |
+
{
|
223 |
+
return $this->_customizableContainerTypes;
|
224 |
+
}
|
225 |
+
|
226 |
+
/**
|
227 |
+
* Return delivery confirmation types of carrier
|
228 |
+
*
|
229 |
+
* @param Varien_Object|null $params
|
230 |
+
* @return array
|
231 |
+
*/
|
232 |
+
public function getDeliveryConfirmationTypes(Varien_Object $params = null)
|
233 |
+
{
|
234 |
+
return array();
|
235 |
+
}
|
236 |
+
|
237 |
+
public function checkAvailableShipCountries(Mage_Shipping_Model_Rate_Request $request)
|
238 |
+
{
|
239 |
+
$speCountriesAllow = $this->getConfigData('sallowspecific');
|
240 |
+
/*
|
241 |
+
* for specific countries, the flag will be 1
|
242 |
+
*/
|
243 |
+
if ($speCountriesAllow && $speCountriesAllow == 1){
|
244 |
+
$showMethod = $this->getConfigData('showmethod');
|
245 |
+
$availableCountries = array();
|
246 |
+
if($this->getConfigData('specificcountry')) {
|
247 |
+
$availableCountries = explode(',',$this->getConfigData('specificcountry'));
|
248 |
+
}
|
249 |
+
if ($availableCountries && in_array($request->getDestCountryId(), $availableCountries)) {
|
250 |
+
return $this;
|
251 |
+
} elseif ($showMethod && (!$availableCountries || ($availableCountries
|
252 |
+
&& !in_array($request->getDestCountryId(), $availableCountries)))
|
253 |
+
){
|
254 |
+
$error = Mage::getModel('shipping/rate_result_error');
|
255 |
+
$error->setCarrier($this->_code);
|
256 |
+
$error->setCarrierTitle($this->getConfigData('title'));
|
257 |
+
$errorMsg = $this->getConfigData('specificerrmsg');
|
258 |
+
$error->setErrorMessage($errorMsg ? $errorMsg : Mage::helper('shipping')->__('The shipping module is not available for selected delivery country.'));
|
259 |
+
return $error;
|
260 |
+
} else {
|
261 |
+
/*
|
262 |
+
* The admin set not to show the shipping module if the devliery country is not within specific countries
|
263 |
+
*/
|
264 |
+
return false;
|
265 |
+
}
|
266 |
+
}
|
267 |
+
return $this;
|
268 |
+
}
|
269 |
+
|
270 |
+
|
271 |
+
/**
|
272 |
+
* Processing additional validation to check is carrier applicable.
|
273 |
+
*
|
274 |
+
* @param Mage_Shipping_Model_Rate_Request $request
|
275 |
+
* @return Mage_Shipping_Model_Carrier_Abstract|Mage_Shipping_Model_Rate_Result_Error|boolean
|
276 |
+
*/
|
277 |
+
public function proccessAdditionalValidation(Mage_Shipping_Model_Rate_Request $request)
|
278 |
+
{
|
279 |
+
return $this;
|
280 |
+
}
|
281 |
+
|
282 |
+
/**
|
283 |
+
* Determine whether current carrier enabled for activity
|
284 |
+
*
|
285 |
+
* @return bool
|
286 |
+
*/
|
287 |
+
public function isActive()
|
288 |
+
{
|
289 |
+
$active = $this->getConfigData('active');
|
290 |
+
return $active==1 || $active=='true';
|
291 |
+
}
|
292 |
+
|
293 |
+
/**
|
294 |
+
* Whether this carrier has fixed rates calculation
|
295 |
+
*
|
296 |
+
* @return bool
|
297 |
+
*/
|
298 |
+
public function isFixed()
|
299 |
+
{
|
300 |
+
return $this->_isFixed;
|
301 |
+
}
|
302 |
+
|
303 |
+
/**
|
304 |
+
* Check if carrier has shipping tracking option available
|
305 |
+
*
|
306 |
+
* @return boolean
|
307 |
+
*/
|
308 |
+
public function isTrackingAvailable()
|
309 |
+
{
|
310 |
+
return false;
|
311 |
+
}
|
312 |
+
|
313 |
+
/**
|
314 |
+
* Check if carrier has shipping label option available
|
315 |
+
*
|
316 |
+
* @return boolean
|
317 |
+
*/
|
318 |
+
public function isShippingLabelsAvailable()
|
319 |
+
{
|
320 |
+
return false;
|
321 |
+
}
|
322 |
+
|
323 |
+
/**
|
324 |
+
* Retrieve sort order of current carrier
|
325 |
+
*
|
326 |
+
* @return mixed
|
327 |
+
*/
|
328 |
+
public function getSortOrder()
|
329 |
+
{
|
330 |
+
return $this->getConfigData('sort_order');
|
331 |
+
}
|
332 |
+
|
333 |
+
/**
|
334 |
+
* @param Mage_Shipping_Model_Rate_Request $request
|
335 |
+
* @return null
|
336 |
+
*/
|
337 |
+
protected function _updateFreeMethodQuote($request)
|
338 |
+
{
|
339 |
+
if ($request->getFreeMethodWeight() == $request->getPackageWeight() || !$request->hasFreeMethodWeight()) {
|
340 |
+
return;
|
341 |
+
}
|
342 |
+
|
343 |
+
$freeMethod = $this->getConfigData($this->_freeMethod);
|
344 |
+
if (!$freeMethod) {
|
345 |
+
return;
|
346 |
+
}
|
347 |
+
$freeRateId = false;
|
348 |
+
|
349 |
+
if (is_object($this->_result)) {
|
350 |
+
foreach ($this->_result->getAllRates() as $i=>$item) {
|
351 |
+
if ($item->getMethod() == $freeMethod) {
|
352 |
+
$freeRateId = $i;
|
353 |
+
break;
|
354 |
+
}
|
355 |
+
}
|
356 |
+
}
|
357 |
+
|
358 |
+
if ($freeRateId === false) {
|
359 |
+
return;
|
360 |
+
}
|
361 |
+
$price = null;
|
362 |
+
if ($request->getFreeMethodWeight() > 0) {
|
363 |
+
$this->_setFreeMethodRequest($freeMethod);
|
364 |
+
|
365 |
+
$result = $this->_getQuotes();
|
366 |
+
if ($result && ($rates = $result->getAllRates()) && count($rates)>0) {
|
367 |
+
if ((count($rates) == 1) && ($rates[0] instanceof Mage_Shipping_Model_Rate_Result_Method)) {
|
368 |
+
$price = $rates[0]->getPrice();
|
369 |
+
}
|
370 |
+
if (count($rates) > 1) {
|
371 |
+
foreach ($rates as $rate) {
|
372 |
+
if ($rate instanceof Mage_Shipping_Model_Rate_Result_Method
|
373 |
+
&& $rate->getMethod() == $freeMethod
|
374 |
+
) {
|
375 |
+
$price = $rate->getPrice();
|
376 |
+
}
|
377 |
+
}
|
378 |
+
}
|
379 |
+
}
|
380 |
+
} else {
|
381 |
+
/**
|
382 |
+
* if we can apply free shipping for all order we should force price
|
383 |
+
* to $0.00 for shipping with out sending second request to carrier
|
384 |
+
*/
|
385 |
+
$price = 0;
|
386 |
+
}
|
387 |
+
|
388 |
+
/**
|
389 |
+
* if we did not get our free shipping method in response we must use its old price
|
390 |
+
*/
|
391 |
+
if (!is_null($price)) {
|
392 |
+
$this->_result->getRateById($freeRateId)->setPrice($price);
|
393 |
+
}
|
394 |
+
}
|
395 |
+
|
396 |
+
/**
|
397 |
+
* Calculate price considering free shipping and handling fee
|
398 |
+
*
|
399 |
+
* @param string $cost
|
400 |
+
* @param string $method
|
401 |
+
* @return float|string
|
402 |
+
*/
|
403 |
+
public function getMethodPrice($cost, $method = '')
|
404 |
+
{
|
405 |
+
return $method == $this->getConfigData($this->_freeMethod)
|
406 |
+
&& $this->getConfigFlag('free_shipping_enable')
|
407 |
+
&& $this->getConfigData('free_shipping_subtotal') <= $this->_rawRequest->getBaseSubtotalInclTax()
|
408 |
+
? '0.00'
|
409 |
+
: $this->getFinalPriceWithHandlingFee($cost);
|
410 |
+
}
|
411 |
+
|
412 |
+
/**
|
413 |
+
* Get the handling fee for the shipping + cost
|
414 |
+
*
|
415 |
+
* @param float $cost
|
416 |
+
* @return float final price for shipping method
|
417 |
+
*/
|
418 |
+
public function getFinalPriceWithHandlingFee($cost)
|
419 |
+
{
|
420 |
+
$handlingFee = $this->getConfigData('handling_fee');
|
421 |
+
$handlingType = $this->getConfigData('handling_type');
|
422 |
+
if (!$handlingType) {
|
423 |
+
$handlingType = self::HANDLING_TYPE_FIXED;
|
424 |
+
}
|
425 |
+
$handlingAction = $this->getConfigData('handling_action');
|
426 |
+
if (!$handlingAction) {
|
427 |
+
$handlingAction = self::HANDLING_ACTION_PERORDER;
|
428 |
+
}
|
429 |
+
|
430 |
+
return $handlingAction == self::HANDLING_ACTION_PERPACKAGE
|
431 |
+
? $this->_getPerpackagePrice($cost, $handlingType, $handlingFee)
|
432 |
+
: $this->_getPerorderPrice($cost, $handlingType, $handlingFee);
|
433 |
+
}
|
434 |
+
|
435 |
+
/**
|
436 |
+
* Get final price for shipping method with handling fee per package
|
437 |
+
*
|
438 |
+
* @param float $cost
|
439 |
+
* @param string $handlingType
|
440 |
+
* @param float $handlingFee
|
441 |
+
* @return float
|
442 |
+
*/
|
443 |
+
protected function _getPerpackagePrice($cost, $handlingType, $handlingFee)
|
444 |
+
{
|
445 |
+
if ($handlingType == self::HANDLING_TYPE_PERCENT) {
|
446 |
+
return ($cost + ($cost * $handlingFee/100)) * $this->_numBoxes;
|
447 |
+
}
|
448 |
+
|
449 |
+
return ($cost + $handlingFee) * $this->_numBoxes;
|
450 |
+
}
|
451 |
+
|
452 |
+
/**
|
453 |
+
* Get final price for shipping method with handling fee per order
|
454 |
+
*
|
455 |
+
* @param float $cost
|
456 |
+
* @param string $handlingType
|
457 |
+
* @param float $handlingFee
|
458 |
+
* @return float
|
459 |
+
*/
|
460 |
+
protected function _getPerorderPrice($cost, $handlingType, $handlingFee)
|
461 |
+
{
|
462 |
+
if ($handlingType == self::HANDLING_TYPE_PERCENT) {
|
463 |
+
return ($cost * $this->_numBoxes) + ($cost * $this->_numBoxes * $handlingFee / 100);
|
464 |
+
}
|
465 |
+
|
466 |
+
return ($cost * $this->_numBoxes) + $handlingFee;
|
467 |
+
}
|
468 |
+
|
469 |
+
/**
|
470 |
+
* Return weight in pounds
|
471 |
+
*
|
472 |
+
* @param integer Weight in someone measure
|
473 |
+
* @return float Weight in pounds
|
474 |
+
*/
|
475 |
+
public function convertWeightToLbs($weight)
|
476 |
+
{
|
477 |
+
return $weight;
|
478 |
+
}
|
479 |
+
|
480 |
+
/**
|
481 |
+
* set the number of boxes for shipping
|
482 |
+
*
|
483 |
+
* @return weight
|
484 |
+
*/
|
485 |
+
public function getTotalNumOfBoxes($weight)
|
486 |
+
{
|
487 |
+
/*
|
488 |
+
reset num box first before retrieve again
|
489 |
+
*/
|
490 |
+
$this->_numBoxes = 1;
|
491 |
+
$weight = $this->convertWeightToLbs($weight);
|
492 |
+
$maxPackageWeight = $this->getConfigData('max_package_weight');
|
493 |
+
if ($weight > $maxPackageWeight && $maxPackageWeight != 0) {
|
494 |
+
$this->_numBoxes = ceil($weight/$maxPackageWeight);
|
495 |
+
$weight = $weight/$this->_numBoxes;
|
496 |
+
}
|
497 |
+
return $weight;
|
498 |
+
}
|
499 |
+
|
500 |
+
/**
|
501 |
+
* Is state province required
|
502 |
+
*
|
503 |
+
* @return bool
|
504 |
+
*/
|
505 |
+
public function isStateProvinceRequired()
|
506 |
+
{
|
507 |
+
return false;
|
508 |
+
}
|
509 |
+
|
510 |
+
/**
|
511 |
+
* Check if city option required
|
512 |
+
*
|
513 |
+
* @return boolean
|
514 |
+
*/
|
515 |
+
public function isCityRequired()
|
516 |
+
{
|
517 |
+
return false;
|
518 |
+
}
|
519 |
+
|
520 |
+
/**
|
521 |
+
* Determine whether zip-code is required for the country of destination
|
522 |
+
*
|
523 |
+
* @param string|null $countryId
|
524 |
+
* @return bool
|
525 |
+
*/
|
526 |
+
public function isZipCodeRequired($countryId = null)
|
527 |
+
{
|
528 |
+
return false;
|
529 |
+
}
|
530 |
+
|
531 |
+
/**
|
532 |
+
* Log debug data to file
|
533 |
+
*
|
534 |
+
* @param mixed $debugData
|
535 |
+
*/
|
536 |
+
protected function _debug($debugData)
|
537 |
+
{
|
538 |
+
if ($this->getDebugFlag()) {
|
539 |
+
Mage::getModel('core/log_adapter', 'shipping_' . $this->getCarrierCode() . '.log')
|
540 |
+
->setFilterDataKeys($this->_debugReplacePrivateDataKeys)
|
541 |
+
->log($debugData);
|
542 |
+
}
|
543 |
+
}
|
544 |
+
|
545 |
+
/**
|
546 |
+
* Define if debugging is enabled
|
547 |
+
*
|
548 |
+
* @return bool
|
549 |
+
*/
|
550 |
+
public function getDebugFlag()
|
551 |
+
{
|
552 |
+
return $this->getConfigData('debug');
|
553 |
+
}
|
554 |
+
|
555 |
+
/**
|
556 |
+
* Used to call debug method from not Payment Method context
|
557 |
+
*
|
558 |
+
* @param mixed $debugData
|
559 |
+
*/
|
560 |
+
public function debugData($debugData)
|
561 |
+
{
|
562 |
+
$this->_debug($debugData);
|
563 |
+
}
|
564 |
+
|
565 |
+
/**
|
566 |
+
* Getter for carrier code
|
567 |
+
*
|
568 |
+
* @return string
|
569 |
+
*/
|
570 |
+
public function getCarrierCode()
|
571 |
+
{
|
572 |
+
return $this->_code;
|
573 |
+
}
|
574 |
+
|
575 |
+
/**
|
576 |
+
* Return content types of package
|
577 |
+
*
|
578 |
+
* @param Varien_Object $params
|
579 |
+
* @return array
|
580 |
+
*/
|
581 |
+
public function getContentTypes(Varien_Object $params)
|
582 |
+
{
|
583 |
+
return array();
|
584 |
+
}
|
585 |
+
}
|
app/code/local/Mage/Shipping/Model/Carrier/Flatrate.php
ADDED
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Flat rate shipping model
|
30 |
+
*
|
31 |
+
* @category Mage
|
32 |
+
* @package Mage_Shipping
|
33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
class Mage_Shipping_Model_Carrier_Flatrate
|
36 |
+
extends Mage_Shipping_Model_Carrier_Abstract
|
37 |
+
implements Mage_Shipping_Model_Carrier_Interface
|
38 |
+
{
|
39 |
+
|
40 |
+
|
41 |
+
protected $_code = 'flatrate';
|
42 |
+
protected $_isFixed = true;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Enter description here...
|
46 |
+
*
|
47 |
+
* @param Mage_Shipping_Model_Rate_Request $data
|
48 |
+
* @return Mage_Shipping_Model_Rate_Result
|
49 |
+
*/
|
50 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
51 |
+
{
|
52 |
+
if (!$this->getConfigFlag('active')) {
|
53 |
+
return false;
|
54 |
+
}
|
55 |
+
|
56 |
+
$freeBoxes = 0;
|
57 |
+
if ($request->getAllItems()) {
|
58 |
+
foreach ($request->getAllItems() as $item) {
|
59 |
+
|
60 |
+
if ($item->getProduct()->isVirtual() || $item->getParentItem()) {
|
61 |
+
continue;
|
62 |
+
}
|
63 |
+
|
64 |
+
if ($item->getHasChildren() && $item->isShipSeparately()) {
|
65 |
+
foreach ($item->getChildren() as $child) {
|
66 |
+
if ($child->getFreeShipping() && !$child->getProduct()->isVirtual()) {
|
67 |
+
$freeBoxes += $item->getQty() * $child->getQty();
|
68 |
+
}
|
69 |
+
}
|
70 |
+
} elseif ($item->getFreeShipping()) {
|
71 |
+
$freeBoxes += $item->getQty();
|
72 |
+
}
|
73 |
+
}
|
74 |
+
}
|
75 |
+
$this->setFreeBoxes($freeBoxes);
|
76 |
+
|
77 |
+
$result = Mage::getModel('shipping/rate_result');
|
78 |
+
if ($this->getConfigData('type') == 'O') { // per order
|
79 |
+
$shippingPrice = $this->getConfigData('price');
|
80 |
+
} elseif ($this->getConfigData('type') == 'I') { // per item
|
81 |
+
$shippingPrice = ($request->getPackageQty() * $this->getConfigData('price')) - ($this->getFreeBoxes() * $this->getConfigData('price'));
|
82 |
+
|
83 |
+
/* subtract flat rate price from freight products */
|
84 |
+
$getcount = '';
|
85 |
+
foreach($request->getAllItems() as $_item) {
|
86 |
+
$getid = $_item->getProductId();
|
87 |
+
$qty = $_item->getQty();
|
88 |
+
$promodel = Mage::getModel('catalog/product')->load($getid);
|
89 |
+
//echo "<pre>";print_r($promodel);exit;
|
90 |
+
$isfreight = $promodel['ship_via_freight'];
|
91 |
+
if($isfreight == 1) {
|
92 |
+
$getcount += $qty;
|
93 |
+
}
|
94 |
+
}
|
95 |
+
$default_price = $this->getConfigData('price');
|
96 |
+
$minus = ($getcount*$default_price);
|
97 |
+
$shippingPrice = ($shippingPrice-$minus);
|
98 |
+
|
99 |
+
} else {
|
100 |
+
$shippingPrice = false;
|
101 |
+
}
|
102 |
+
|
103 |
+
$shippingPrice = $this->getFinalPriceWithHandlingFee($shippingPrice);
|
104 |
+
|
105 |
+
if ($shippingPrice !== false) {
|
106 |
+
$method = Mage::getModel('shipping/rate_result_method');
|
107 |
+
|
108 |
+
$method->setCarrier('flatrate');
|
109 |
+
$method->setCarrierTitle($this->getConfigData('title'));
|
110 |
+
|
111 |
+
$method->setMethod('flatrate');
|
112 |
+
$method->setMethodTitle($this->getConfigData('name'));
|
113 |
+
|
114 |
+
if ($request->getFreeShipping() === true || $request->getPackageQty() == $this->getFreeBoxes()) {
|
115 |
+
$shippingPrice = '0.00';
|
116 |
+
}
|
117 |
+
|
118 |
+
|
119 |
+
$method->setPrice($shippingPrice);
|
120 |
+
$method->setCost($shippingPrice);
|
121 |
+
|
122 |
+
$result->append($method);
|
123 |
+
}
|
124 |
+
|
125 |
+
return $result;
|
126 |
+
}
|
127 |
+
|
128 |
+
public function getAllowedMethods()
|
129 |
+
{
|
130 |
+
return array('flatrate'=>$this->getConfigData('name'));
|
131 |
+
}
|
132 |
+
|
133 |
+
}
|
app/code/local/Mage/Shipping/Model/Carrier/Flatrate_org21stJune.php
ADDED
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Flat rate shipping model
|
30 |
+
*
|
31 |
+
* @category Mage
|
32 |
+
* @package Mage_Shipping
|
33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
class Mage_Shipping_Model_Carrier_Flatrate
|
36 |
+
extends Mage_Shipping_Model_Carrier_Abstract
|
37 |
+
implements Mage_Shipping_Model_Carrier_Interface
|
38 |
+
{
|
39 |
+
|
40 |
+
protected $_code = 'flatrate';
|
41 |
+
protected $_isFixed = true;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Enter description here...
|
45 |
+
*
|
46 |
+
* @param Mage_Shipping_Model_Rate_Request $data
|
47 |
+
* @return Mage_Shipping_Model_Rate_Result
|
48 |
+
*/
|
49 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
50 |
+
{
|
51 |
+
if (!$this->getConfigFlag('active')) {
|
52 |
+
return false;
|
53 |
+
}
|
54 |
+
|
55 |
+
$freeBoxes = 0;
|
56 |
+
if ($request->getAllItems()) {
|
57 |
+
foreach ($request->getAllItems() as $item) {
|
58 |
+
|
59 |
+
if ($item->getProduct()->isVirtual() || $item->getParentItem()) {
|
60 |
+
continue;
|
61 |
+
}
|
62 |
+
|
63 |
+
if ($item->getHasChildren() && $item->isShipSeparately()) {
|
64 |
+
foreach ($item->getChildren() as $child) {
|
65 |
+
if ($child->getFreeShipping() && !$child->getProduct()->isVirtual()) {
|
66 |
+
$freeBoxes += $item->getQty() * $child->getQty();
|
67 |
+
}
|
68 |
+
}
|
69 |
+
} elseif ($item->getFreeShipping()) {
|
70 |
+
$freeBoxes += $item->getQty();
|
71 |
+
}
|
72 |
+
}
|
73 |
+
}
|
74 |
+
$this->setFreeBoxes($freeBoxes);
|
75 |
+
|
76 |
+
$result = Mage::getModel('shipping/rate_result');
|
77 |
+
if ($this->getConfigData('type') == 'O') { // per order
|
78 |
+
$shippingPrice = $this->getConfigData('price');
|
79 |
+
} elseif ($this->getConfigData('type') == 'I') { // per item
|
80 |
+
$shippingPrice = ($request->getPackageQty() * $this->getConfigData('price')) - ($this->getFreeBoxes() * $this->getConfigData('price'));
|
81 |
+
} else {
|
82 |
+
$shippingPrice = false;
|
83 |
+
}
|
84 |
+
|
85 |
+
$shippingPrice = $this->getFinalPriceWithHandlingFee($shippingPrice);
|
86 |
+
|
87 |
+
if ($shippingPrice !== false) {
|
88 |
+
$method = Mage::getModel('shipping/rate_result_method');
|
89 |
+
|
90 |
+
$method->setCarrier('flatrate');
|
91 |
+
$method->setCarrierTitle($this->getConfigData('title'));
|
92 |
+
|
93 |
+
$method->setMethod('flatrate');
|
94 |
+
$method->setMethodTitle($this->getConfigData('name'));
|
95 |
+
|
96 |
+
if ($request->getFreeShipping() === true || $request->getPackageQty() == $this->getFreeBoxes()) {
|
97 |
+
$shippingPrice = '0.00';
|
98 |
+
}
|
99 |
+
|
100 |
+
|
101 |
+
$method->setPrice($shippingPrice);
|
102 |
+
$method->setCost($shippingPrice);
|
103 |
+
|
104 |
+
$result->append($method);
|
105 |
+
}
|
106 |
+
|
107 |
+
return $result;
|
108 |
+
}
|
109 |
+
|
110 |
+
public function getAllowedMethods()
|
111 |
+
{
|
112 |
+
return array('flatrate'=>$this->getConfigData('name'));
|
113 |
+
}
|
114 |
+
|
115 |
+
}
|
app/code/local/Mage/Shipping/Model/Carrier/Freeshipping.php
ADDED
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Free shipping model
|
30 |
+
*
|
31 |
+
* @category Mage
|
32 |
+
* @package Mage_Shipping
|
33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
class Mage_Shipping_Model_Carrier_Freeshipping
|
36 |
+
extends Mage_Shipping_Model_Carrier_Abstract
|
37 |
+
implements Mage_Shipping_Model_Carrier_Interface
|
38 |
+
{
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Carrier's code
|
42 |
+
*
|
43 |
+
* @var string
|
44 |
+
*/
|
45 |
+
protected $_code = 'freeshipping';
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Whether this carrier has fixed rates calculation
|
49 |
+
*
|
50 |
+
* @var bool
|
51 |
+
*/
|
52 |
+
protected $_isFixed = true;
|
53 |
+
|
54 |
+
/**
|
55 |
+
* FreeShipping Rates Collector
|
56 |
+
*
|
57 |
+
* @param Mage_Shipping_Model_Rate_Request $request
|
58 |
+
* @return Mage_Shipping_Model_Rate_Result
|
59 |
+
*/
|
60 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
61 |
+
{
|
62 |
+
if (!$this->getConfigFlag('active')) {
|
63 |
+
return false;
|
64 |
+
}
|
65 |
+
|
66 |
+
$result = Mage::getModel('shipping/rate_result');
|
67 |
+
|
68 |
+
$this->_updateFreeMethodQuote($request);
|
69 |
+
|
70 |
+
if (($request->getFreeShipping())
|
71 |
+
|| ($request->getBaseSubtotalInclTax() >=
|
72 |
+
$this->getConfigData('free_shipping_subtotal'))
|
73 |
+
) {
|
74 |
+
$method = Mage::getModel('shipping/rate_result_method');
|
75 |
+
|
76 |
+
$method->setCarrier('freeshipping');
|
77 |
+
$method->setCarrierTitle($this->getConfigData('title'));
|
78 |
+
|
79 |
+
$method->setMethod('freeshipping');
|
80 |
+
$method->setMethodTitle($this->getConfigData('name'));
|
81 |
+
|
82 |
+
$method->setPrice('0.00');
|
83 |
+
$method->setCost('0.00');
|
84 |
+
|
85 |
+
$result->append($method);
|
86 |
+
}
|
87 |
+
|
88 |
+
return $result;
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Allows free shipping when all product items have free shipping (promotions etc.)
|
93 |
+
*
|
94 |
+
* @param Mage_Shipping_Model_Rate_Request $request
|
95 |
+
* @return void
|
96 |
+
*/
|
97 |
+
protected function _updateFreeMethodQuote($request)
|
98 |
+
{
|
99 |
+
$freeShipping = false;
|
100 |
+
$items = $request->getAllItems();
|
101 |
+
$c = count($items);
|
102 |
+
for ($i = 0; $i < $c; $i++) {
|
103 |
+
if ($items[$i]->getProduct() instanceof Mage_Catalog_Model_Product) {
|
104 |
+
if ($items[$i]->getFreeShipping()) {
|
105 |
+
$freeShipping = true;
|
106 |
+
} else {
|
107 |
+
return;
|
108 |
+
}
|
109 |
+
}
|
110 |
+
}
|
111 |
+
if ($freeShipping) {
|
112 |
+
$request->setFreeShipping(true);
|
113 |
+
}
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Get allowed shipping methods
|
118 |
+
*
|
119 |
+
* @return array
|
120 |
+
*/
|
121 |
+
public function getAllowedMethods()
|
122 |
+
{
|
123 |
+
return array('freeshipping' => $this->getConfigData('name'));
|
124 |
+
}
|
125 |
+
|
126 |
+
}
|
app/code/local/Mage/Shipping/Model/Carrier/Interface.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
interface Mage_Shipping_Model_Carrier_Interface
|
29 |
+
{
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Check if carrier has shipping tracking option available
|
33 |
+
*
|
34 |
+
* @return boolean
|
35 |
+
*/
|
36 |
+
public function isTrackingAvailable();
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Get allowed shipping methods
|
40 |
+
*
|
41 |
+
* @return array
|
42 |
+
*/
|
43 |
+
public function getAllowedMethods();
|
44 |
+
|
45 |
+
}
|
app/code/local/Mage/Shipping/Model/Carrier/Pickup.php
ADDED
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
class Mage_Shipping_Model_Carrier_Pickup
|
29 |
+
extends Mage_Shipping_Model_Carrier_Abstract
|
30 |
+
implements Mage_Shipping_Model_Carrier_Interface
|
31 |
+
{
|
32 |
+
|
33 |
+
protected $_code = 'pickup';
|
34 |
+
protected $_isFixed = true;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Enter description here...
|
38 |
+
*
|
39 |
+
* @param Mage_Shipping_Model_Rate_Request $data
|
40 |
+
* @return Mage_Shipping_Model_Rate_Result
|
41 |
+
*/
|
42 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
43 |
+
{
|
44 |
+
if (!$this->getConfigFlag('active')) {
|
45 |
+
return false;
|
46 |
+
}
|
47 |
+
|
48 |
+
$result = Mage::getModel('shipping/rate_result');
|
49 |
+
|
50 |
+
if (!empty($rate)) {
|
51 |
+
$method = Mage::getModel('shipping/rate_result_method');
|
52 |
+
|
53 |
+
$method->setCarrier('pickup');
|
54 |
+
$method->setCarrierTitle($this->getConfigData('title'));
|
55 |
+
|
56 |
+
$method->setMethod('store');
|
57 |
+
$method->setMethodTitle(Mage::helper('shipping')->__('Store Pickup'));
|
58 |
+
|
59 |
+
$method->setPrice(0);
|
60 |
+
$method->setCost(0);
|
61 |
+
|
62 |
+
$result->append($method);
|
63 |
+
}
|
64 |
+
|
65 |
+
return $result;
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Get allowed shipping methods
|
70 |
+
*
|
71 |
+
* @return array
|
72 |
+
*/
|
73 |
+
public function getAllowedMethods()
|
74 |
+
{
|
75 |
+
return array('pickup'=>Mage::helper('shipping')->__('Store Pickup'));
|
76 |
+
}
|
77 |
+
|
78 |
+
}
|
app/code/local/Mage/Shipping/Model/Carrier/Tablerate.php
ADDED
@@ -0,0 +1,280 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/*
|
28 |
+
* Class Mage_Shipping_Model_Carrier_Tablerate
|
29 |
+
*/
|
30 |
+
class Mage_Shipping_Model_Carrier_Tablerate
|
31 |
+
extends Mage_Shipping_Model_Carrier_Abstract
|
32 |
+
implements Mage_Shipping_Model_Carrier_Interface
|
33 |
+
{
|
34 |
+
|
35 |
+
/**
|
36 |
+
* code name
|
37 |
+
*
|
38 |
+
* @var string
|
39 |
+
*/
|
40 |
+
protected $_code = 'tablerate';
|
41 |
+
|
42 |
+
/**
|
43 |
+
* boolean isFixed
|
44 |
+
*
|
45 |
+
* @var boolean
|
46 |
+
*/
|
47 |
+
protected $_isFixed = true;
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Default condition name
|
51 |
+
*
|
52 |
+
* @var string
|
53 |
+
*/
|
54 |
+
protected $_default_condition_name = 'package_weight';
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Condition names
|
58 |
+
*
|
59 |
+
* @var array
|
60 |
+
*/
|
61 |
+
protected $_conditionNames = array();
|
62 |
+
|
63 |
+
/*
|
64 |
+
* Constructor
|
65 |
+
*/
|
66 |
+
public function __construct()
|
67 |
+
{
|
68 |
+
parent::__construct();
|
69 |
+
foreach ($this->getCode('condition_name') as $k => $v) {
|
70 |
+
$this->_conditionNames[] = $k;
|
71 |
+
}
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Collect and get rates
|
76 |
+
*
|
77 |
+
* @param Mage_Shipping_Model_Rate_Request $request
|
78 |
+
* @return Mage_Shipping_Model_Rate_Result
|
79 |
+
*/
|
80 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
81 |
+
{
|
82 |
+
if (!$this->getConfigFlag('active')) {
|
83 |
+
return false;
|
84 |
+
}
|
85 |
+
|
86 |
+
// exclude Virtual products price from Package value if pre-configured
|
87 |
+
if (!$this->getConfigFlag('include_virtual_price') && $request->getAllItems()) {
|
88 |
+
foreach ($request->getAllItems() as $item) {
|
89 |
+
if ($item->getParentItem()) {
|
90 |
+
continue;
|
91 |
+
}
|
92 |
+
if ($item->getHasChildren() && $item->isShipSeparately()) {
|
93 |
+
foreach ($item->getChildren() as $child) {
|
94 |
+
if ($child->getProduct()->isVirtual()) {
|
95 |
+
$request->setPackageValue($request->getPackageValue() - $child->getBaseRowTotal());
|
96 |
+
}
|
97 |
+
}
|
98 |
+
} elseif ($item->getProduct()->isVirtual()) {
|
99 |
+
$request->setPackageValue($request->getPackageValue() - $item->getBaseRowTotal());
|
100 |
+
}
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
// Free shipping by qty
|
105 |
+
$freeQty = 0;
|
106 |
+
if ($request->getAllItems()) {
|
107 |
+
$freePackageValue = 0;
|
108 |
+
foreach ($request->getAllItems() as $item) {
|
109 |
+
if ($item->getProduct()->isVirtual() || $item->getParentItem()) {
|
110 |
+
continue;
|
111 |
+
}
|
112 |
+
|
113 |
+
if ($item->getHasChildren() && $item->isShipSeparately()) {
|
114 |
+
foreach ($item->getChildren() as $child) {
|
115 |
+
if ($child->getFreeShipping() && !$child->getProduct()->isVirtual()) {
|
116 |
+
$freeShipping = is_numeric($child->getFreeShipping()) ? $child->getFreeShipping() : 0;
|
117 |
+
$freeQty += $item->getQty() * ($child->getQty() - $freeShipping);
|
118 |
+
}
|
119 |
+
}
|
120 |
+
} elseif ($item->getFreeShipping()) {
|
121 |
+
$freeShipping = is_numeric($item->getFreeShipping()) ? $item->getFreeShipping() : 0;
|
122 |
+
$freeQty += $item->getQty() - $freeShipping;
|
123 |
+
$freePackageValue += $item->getBaseRowTotal();
|
124 |
+
}
|
125 |
+
}
|
126 |
+
$oldValue = $request->getPackageValue();
|
127 |
+
$request->setPackageValue($oldValue - $freePackageValue);
|
128 |
+
}
|
129 |
+
|
130 |
+
if ($freePackageValue) {
|
131 |
+
$request->setPackageValue($request->getPackageValue() - $freePackageValue);
|
132 |
+
}
|
133 |
+
if (!$request->getConditionName()) {
|
134 |
+
$conditionName = $this->getConfigData('condition_name');
|
135 |
+
$request->setConditionName($conditionName ? $conditionName : $this->_default_condition_name);
|
136 |
+
}
|
137 |
+
|
138 |
+
// Package weight and qty free shipping
|
139 |
+
$oldWeight = $request->getPackageWeight();
|
140 |
+
$oldQty = $request->getPackageQty();
|
141 |
+
|
142 |
+
$request->setPackageWeight($request->getFreeMethodWeight());
|
143 |
+
$request->setPackageQty($oldQty - $freeQty);
|
144 |
+
|
145 |
+
$result = $this->_getModel('shipping/rate_result');
|
146 |
+
$rate = $this->getRate($request);
|
147 |
+
|
148 |
+
$request->setPackageWeight($oldWeight);
|
149 |
+
$request->setPackageQty($oldQty);
|
150 |
+
|
151 |
+
if (!empty($rate) && $rate['price'] >= 0) {
|
152 |
+
$method = $this->_getModel('shipping/rate_result_method');
|
153 |
+
|
154 |
+
$method->setCarrier('tablerate');
|
155 |
+
$method->setCarrierTitle($this->getConfigData('title'));
|
156 |
+
|
157 |
+
$method->setMethod('bestway');
|
158 |
+
$method->setMethodTitle($this->getConfigData('name'));
|
159 |
+
|
160 |
+
if ($request->getFreeShipping() === true || ($request->getPackageQty() == $freeQty)) {
|
161 |
+
$shippingPrice = 0;
|
162 |
+
} else {
|
163 |
+
$shippingPrice = $this->getFinalPriceWithHandlingFee($rate['price']);
|
164 |
+
}
|
165 |
+
|
166 |
+
$method->setPrice($shippingPrice);
|
167 |
+
$method->setCost($rate['cost']);
|
168 |
+
|
169 |
+
$result->append($method);
|
170 |
+
} elseif (empty($rate) && $request->getFreeShipping() === true) {
|
171 |
+
/**
|
172 |
+
* was applied promotion rule for whole cart
|
173 |
+
* other shipping methods could be switched off at all
|
174 |
+
* we must show table rate method with 0$ price, if grand_total more, than min table condition_value
|
175 |
+
* free setPackageWeight() has already was taken into account
|
176 |
+
*/
|
177 |
+
$request->setPackageValue($freePackageValue);
|
178 |
+
$request->setPackageQty($freeQty);
|
179 |
+
$rate = $this->getRate($request);
|
180 |
+
if (!empty($rate) && $rate['price'] >= 0) {
|
181 |
+
$method = $this->_getModel('shipping/rate_result_method');
|
182 |
+
|
183 |
+
$method->setCarrier('tablerate');
|
184 |
+
$method->setCarrierTitle($this->getConfigData('title'));
|
185 |
+
|
186 |
+
$method->setMethod('bestway');
|
187 |
+
$method->setMethodTitle($this->getConfigData('name'));
|
188 |
+
|
189 |
+
$method->setPrice(0);
|
190 |
+
$method->setCost(0);
|
191 |
+
|
192 |
+
$result->append($method);
|
193 |
+
}
|
194 |
+
} else {
|
195 |
+
$error = $this->_getModel('shipping/rate_result_error');
|
196 |
+
$error->setCarrier('tablerate');
|
197 |
+
$error->setCarrierTitle($this->getConfigData('title'));
|
198 |
+
$error->setErrorMessage($this->getConfigData('specificerrmsg'));
|
199 |
+
$result->append($error);
|
200 |
+
}
|
201 |
+
|
202 |
+
return $result;
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* Get Model
|
207 |
+
*
|
208 |
+
* @param string $modelName
|
209 |
+
*
|
210 |
+
* @return Mage_Core_Model_Abstract
|
211 |
+
*/
|
212 |
+
protected function _getModel($modelName)
|
213 |
+
{
|
214 |
+
return Mage::getModel($modelName);
|
215 |
+
}
|
216 |
+
|
217 |
+
/**
|
218 |
+
* Get Rate
|
219 |
+
*
|
220 |
+
* @param Mage_Shipping_Model_Rate_Request $request
|
221 |
+
*
|
222 |
+
* @return Mage_Core_Model_Abstract
|
223 |
+
*/
|
224 |
+
public function getRate(Mage_Shipping_Model_Rate_Request $request)
|
225 |
+
{
|
226 |
+
return Mage::getResourceModel('shipping/carrier_tablerate')->getRate($request);
|
227 |
+
}
|
228 |
+
|
229 |
+
/**
|
230 |
+
* Get code
|
231 |
+
*
|
232 |
+
* @param string $type
|
233 |
+
* @param string $code
|
234 |
+
*
|
235 |
+
* @return array
|
236 |
+
*/
|
237 |
+
public function getCode($type, $code = '')
|
238 |
+
{
|
239 |
+
$codes = array(
|
240 |
+
|
241 |
+
'condition_name' => array(
|
242 |
+
'package_weight' => Mage::helper('shipping')->__('Weight vs. Destination'),
|
243 |
+
'package_value' => Mage::helper('shipping')->__('Price vs. Destination'),
|
244 |
+
'package_qty' => Mage::helper('shipping')->__('# of Items vs. Destination'),
|
245 |
+
),
|
246 |
+
|
247 |
+
'condition_name_short' => array(
|
248 |
+
'package_weight' => Mage::helper('shipping')->__('Weight (and above)'),
|
249 |
+
'package_value' => Mage::helper('shipping')->__('Order Subtotal (and above)'),
|
250 |
+
'package_qty' => Mage::helper('shipping')->__('# of Items (and above)'),
|
251 |
+
),
|
252 |
+
|
253 |
+
);
|
254 |
+
|
255 |
+
if (!isset($codes[$type])) {
|
256 |
+
throw Mage::exception('Mage_Shipping', Mage::helper('shipping')->__('Invalid Table Rate code type: %s', $type));
|
257 |
+
}
|
258 |
+
|
259 |
+
if ('' === $code) {
|
260 |
+
return $codes[$type];
|
261 |
+
}
|
262 |
+
|
263 |
+
if (!isset($codes[$type][$code])) {
|
264 |
+
throw Mage::exception('Mage_Shipping', Mage::helper('shipping')->__('Invalid Table Rate code for type %s: %s', $type, $code));
|
265 |
+
}
|
266 |
+
|
267 |
+
return $codes[$type][$code];
|
268 |
+
}
|
269 |
+
|
270 |
+
/**
|
271 |
+
* Get allowed shipping methods
|
272 |
+
*
|
273 |
+
* @return array
|
274 |
+
*/
|
275 |
+
public function getAllowedMethods()
|
276 |
+
{
|
277 |
+
return array('bestway' => $this->getConfigData('name'));
|
278 |
+
}
|
279 |
+
|
280 |
+
}
|
app/code/local/Mage/Shipping/Model/Config.php
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
class Mage_Shipping_Model_Config extends Varien_Object
|
29 |
+
{
|
30 |
+
/**
|
31 |
+
* Shipping origin settings
|
32 |
+
*/
|
33 |
+
const XML_PATH_ORIGIN_COUNTRY_ID = 'shipping/origin/country_id';
|
34 |
+
const XML_PATH_ORIGIN_REGION_ID = 'shipping/origin/region_id';
|
35 |
+
const XML_PATH_ORIGIN_CITY = 'shipping/origin/city';
|
36 |
+
const XML_PATH_ORIGIN_POSTCODE = 'shipping/origin/postcode';
|
37 |
+
|
38 |
+
protected static $_carriers;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Retrieve active system carriers
|
42 |
+
*
|
43 |
+
* @param mixed $store
|
44 |
+
* @return array
|
45 |
+
*/
|
46 |
+
public function getActiveCarriers($store = null)
|
47 |
+
{
|
48 |
+
$carriers = array();
|
49 |
+
$config = Mage::getStoreConfig('carriers', $store);
|
50 |
+
foreach ($config as $code => $carrierConfig) {
|
51 |
+
if (Mage::getStoreConfigFlag('carriers/'.$code.'/active', $store)) {
|
52 |
+
$carrierModel = $this->_getCarrier($code, $carrierConfig, $store);
|
53 |
+
if ($carrierModel) {
|
54 |
+
$carriers[$code] = $carrierModel;
|
55 |
+
}
|
56 |
+
}
|
57 |
+
}
|
58 |
+
return $carriers;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Retrieve all system carriers
|
63 |
+
*
|
64 |
+
* @param mixed $store
|
65 |
+
* @return array
|
66 |
+
*/
|
67 |
+
public function getAllCarriers($store = null)
|
68 |
+
{
|
69 |
+
$carriers = array();
|
70 |
+
$config = Mage::getStoreConfig('carriers', $store);
|
71 |
+
foreach ($config as $code => $carrierConfig) {
|
72 |
+
$model = $this->_getCarrier($code, $carrierConfig, $store);
|
73 |
+
if ($model) {
|
74 |
+
$carriers[$code] = $model;
|
75 |
+
}
|
76 |
+
}
|
77 |
+
return $carriers;
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Retrieve carrier model instance by carrier code
|
82 |
+
*
|
83 |
+
* @param string $carrierCode
|
84 |
+
* @param mixed $store
|
85 |
+
* @return Mage_Usa_Model_Shipping_Carrier_Abstract
|
86 |
+
*/
|
87 |
+
public function getCarrierInstance($carrierCode, $store = null)
|
88 |
+
{
|
89 |
+
$carrierConfig = Mage::getStoreConfig('carriers/'.$carrierCode, $store);
|
90 |
+
if (!empty($carrierConfig)) {
|
91 |
+
return $this->_getCarrier($carrierCode, $carrierConfig, $store);
|
92 |
+
}
|
93 |
+
return false;
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Get carrier model object
|
98 |
+
*
|
99 |
+
* @param string $code
|
100 |
+
* @param array $config
|
101 |
+
* @param mixed $store
|
102 |
+
* @return Mage_Shipping_Model_Carrier_Abstract
|
103 |
+
*/
|
104 |
+
protected function _getCarrier($code, $config, $store = null)
|
105 |
+
{
|
106 |
+
if (!isset($config['model'])) {
|
107 |
+
return false;
|
108 |
+
}
|
109 |
+
$modelName = $config['model'];
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Added protection from not existing models usage.
|
113 |
+
* Related with module uninstall process
|
114 |
+
*/
|
115 |
+
try {
|
116 |
+
$carrier = Mage::getModel($modelName);
|
117 |
+
} catch (Exception $e) {
|
118 |
+
Mage::logException($e);
|
119 |
+
return false;
|
120 |
+
}
|
121 |
+
$carrier->setId($code)->setStore($store);
|
122 |
+
self::$_carriers[$code] = $carrier;
|
123 |
+
return self::$_carriers[$code];
|
124 |
+
}
|
125 |
+
}
|
app/code/local/Mage/Shipping/Model/Info.php
ADDED
@@ -0,0 +1,169 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
class Mage_Shipping_Model_Info extends Varien_Object
|
29 |
+
{
|
30 |
+
/**
|
31 |
+
* Tracking info
|
32 |
+
*
|
33 |
+
* @var array
|
34 |
+
*/
|
35 |
+
protected $_trackingInfo = array();
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Generating tracking info
|
39 |
+
*
|
40 |
+
* @param array $hash
|
41 |
+
* @return Mage_Shipping_Model_Info
|
42 |
+
*/
|
43 |
+
public function loadByHash($hash)
|
44 |
+
{
|
45 |
+
/* @var $helper Mage_Shipping_Helper_Data */
|
46 |
+
$helper = Mage::helper('shipping');
|
47 |
+
$data = $helper->decodeTrackingHash($hash);
|
48 |
+
if (!empty($data)) {
|
49 |
+
$this->setData($data['key'], $data['id']);
|
50 |
+
$this->setProtectCode($data['hash']);
|
51 |
+
|
52 |
+
if ($this->getOrderId() > 0) {
|
53 |
+
$this->getTrackingInfoByOrder();
|
54 |
+
} elseif($this->getShipId() > 0) {
|
55 |
+
$this->getTrackingInfoByShip();
|
56 |
+
} else {
|
57 |
+
$this->getTrackingInfoByTrackId();
|
58 |
+
}
|
59 |
+
}
|
60 |
+
return $this;
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Retrieve tracking info
|
65 |
+
*
|
66 |
+
* @return array
|
67 |
+
*/
|
68 |
+
public function getTrackingInfo()
|
69 |
+
{
|
70 |
+
return $this->_trackingInfo;
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Instantiate order model
|
75 |
+
*
|
76 |
+
* @return Mage_Sales_Model_Order|bool
|
77 |
+
*/
|
78 |
+
protected function _initOrder()
|
79 |
+
{
|
80 |
+
$order = Mage::getModel('sales/order')->load($this->getOrderId());
|
81 |
+
|
82 |
+
if (!$order->getId() || $this->getProtectCode() != $order->getProtectCode()) {
|
83 |
+
return false;
|
84 |
+
}
|
85 |
+
|
86 |
+
return $order;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Instantiate ship model
|
91 |
+
*
|
92 |
+
* @return Mage_Sales_Model_Order_Shipment|bool
|
93 |
+
*/
|
94 |
+
protected function _initShipment()
|
95 |
+
{
|
96 |
+
/* @var $model Mage_Sales_Model_Order_Shipment */
|
97 |
+
$model = Mage::getModel('sales/order_shipment');
|
98 |
+
$ship = $model->load($this->getShipId());
|
99 |
+
if (!$ship->getEntityId() || $this->getProtectCode() != $ship->getProtectCode()) {
|
100 |
+
return false;
|
101 |
+
}
|
102 |
+
|
103 |
+
return $ship;
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Retrieve all tracking by order id
|
108 |
+
*
|
109 |
+
* @return array
|
110 |
+
*/
|
111 |
+
public function getTrackingInfoByOrder()
|
112 |
+
{
|
113 |
+
$shipTrack = array();
|
114 |
+
$order = $this->_initOrder();
|
115 |
+
if ($order) {
|
116 |
+
$shipments = $order->getShipmentsCollection();
|
117 |
+
foreach ($shipments as $shipment){
|
118 |
+
$increment_id = $shipment->getIncrementId();
|
119 |
+
$tracks = $shipment->getTracksCollection();
|
120 |
+
|
121 |
+
$trackingInfos=array();
|
122 |
+
foreach ($tracks as $track){
|
123 |
+
$trackingInfos[] = $track->getNumberDetail();
|
124 |
+
}
|
125 |
+
$shipTrack[$increment_id] = $trackingInfos;
|
126 |
+
}
|
127 |
+
}
|
128 |
+
$this->_trackingInfo = $shipTrack;
|
129 |
+
return $this->_trackingInfo;
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Retrieve all tracking by ship id
|
134 |
+
*
|
135 |
+
* @return array
|
136 |
+
*/
|
137 |
+
public function getTrackingInfoByShip()
|
138 |
+
{
|
139 |
+
$shipTrack = array();
|
140 |
+
$shipment = $this->_initShipment();
|
141 |
+
if ($shipment) {
|
142 |
+
$increment_id = $shipment->getIncrementId();
|
143 |
+
$tracks = $shipment->getTracksCollection();
|
144 |
+
|
145 |
+
$trackingInfos=array();
|
146 |
+
foreach ($tracks as $track){
|
147 |
+
$trackingInfos[] = $track->getNumberDetail();
|
148 |
+
}
|
149 |
+
$shipTrack[$increment_id] = $trackingInfos;
|
150 |
+
|
151 |
+
}
|
152 |
+
$this->_trackingInfo = $shipTrack;
|
153 |
+
return $this->_trackingInfo;
|
154 |
+
}
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Retrieve tracking by tracking entity id
|
158 |
+
*
|
159 |
+
* @return array
|
160 |
+
*/
|
161 |
+
public function getTrackingInfoByTrackId()
|
162 |
+
{
|
163 |
+
$track = Mage::getModel('sales/order_shipment_track')->load($this->getTrackId());
|
164 |
+
if ($track->getId() && $this->getProtectCode() == $track->getProtectCode()) {
|
165 |
+
$this->_trackingInfo = array(array($track->getNumberDetail()));
|
166 |
+
}
|
167 |
+
return $this->_trackingInfo;
|
168 |
+
}
|
169 |
+
}
|
app/code/local/Mage/Shipping/Model/Mysql4/Carrier/Tablerate.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Shipping table rates
|
30 |
+
*
|
31 |
+
* @category Mage
|
32 |
+
* @package Mage_Shipping
|
33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
class Mage_Shipping_Model_Mysql4_Carrier_Tablerate extends Mage_Shipping_Model_Resource_Carrier_Tablerate
|
36 |
+
{
|
37 |
+
}
|
app/code/local/Mage/Shipping/Model/Mysql4/Carrier/Tablerate/Collection.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Shipping table rates collection
|
30 |
+
*
|
31 |
+
* @category Mage
|
32 |
+
* @package Mage_Shipping
|
33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
class Mage_Shipping_Model_Mysql4_Carrier_Tablerate_Collection
|
36 |
+
extends Mage_Shipping_Model_Resource_Carrier_Tablerate_Collection
|
37 |
+
{
|
38 |
+
}
|
app/code/local/Mage/Shipping/Model/Rate/Abstract.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
abstract class Mage_Shipping_Model_Rate_Abstract extends Mage_Core_Model_Abstract
|
29 |
+
{
|
30 |
+
static protected $_instances;
|
31 |
+
|
32 |
+
public function getCarrierInstance()
|
33 |
+
{
|
34 |
+
$code = $this->getCarrier();
|
35 |
+
if (!isset(self::$_instances[$code])) {
|
36 |
+
self::$_instances[$code] = Mage::getModel('shipping/config')->getCarrierInstance($code);
|
37 |
+
}
|
38 |
+
return self::$_instances[$code];
|
39 |
+
}
|
40 |
+
}
|
app/code/local/Mage/Shipping/Model/Rate/Request.php
ADDED
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Fields:
|
29 |
+
* - orig:
|
30 |
+
* - country_id: UK
|
31 |
+
* - region_id: 1
|
32 |
+
* - postcode: 90034
|
33 |
+
* - dest:
|
34 |
+
* - country_id: UK
|
35 |
+
* - region_id: 2
|
36 |
+
* - postcode: 01005
|
37 |
+
* - package:
|
38 |
+
* - value: $100
|
39 |
+
* - weight: 1.5 lb
|
40 |
+
* - height: 10"
|
41 |
+
* - width: 10"
|
42 |
+
* - depth: 10"
|
43 |
+
* - order:
|
44 |
+
* - total_qty: 10
|
45 |
+
* - subtotal: $100
|
46 |
+
* - option
|
47 |
+
* - insurance: true
|
48 |
+
* - handling: $1
|
49 |
+
* - table (shiptable)
|
50 |
+
* - condition_name: package_weight
|
51 |
+
* - limit
|
52 |
+
* - carrier: ups
|
53 |
+
* - method: 3dp
|
54 |
+
* - ups
|
55 |
+
* - pickup: CC
|
56 |
+
* - container: CP
|
57 |
+
* - address: RES
|
58 |
+
*
|
59 |
+
* @method int getStoreId()
|
60 |
+
* @method Mage_Shipping_Model_Rate_Request setStoreId(int $value)
|
61 |
+
* @method int getWebsiteId()
|
62 |
+
* @method Mage_Shipping_Model_Rate_Request setWebsiteId(int $value)
|
63 |
+
* @method string getBaseCurrency()
|
64 |
+
* @method Mage_Shipping_Model_Rate_Request setBaseCurrency(string $value)
|
65 |
+
*
|
66 |
+
* @method Mage_Shipping_Model_Rate_Request setAllItems(array $items)
|
67 |
+
* @method array getAllItems()
|
68 |
+
*
|
69 |
+
* @method Mage_Shipping_Model_Rate_Request setOrigCountryId(string $value)
|
70 |
+
* @method string getOrigCountryId()
|
71 |
+
* @method Mage_Shipping_Model_Rate_Request setOrigRegionId(int $value)
|
72 |
+
* @method int getOrigRegionId()
|
73 |
+
* @method Mage_Shipping_Model_Rate_Request setOrigPostcode(string $value)
|
74 |
+
* @method string getOrigPostcode()
|
75 |
+
* @method Mage_Shipping_Model_Rate_Request setOrigCity(string $value)
|
76 |
+
* @method string getOrigCity()
|
77 |
+
*
|
78 |
+
* @method Mage_Shipping_Model_Rate_Request setDestCountryId(string $value)
|
79 |
+
* @method string getDestCountryId()
|
80 |
+
* @method Mage_Shipping_Model_Rate_Request setDestRegionId(int $value)
|
81 |
+
* @method int getDestRegionId()
|
82 |
+
* @method Mage_Shipping_Model_Rate_Request setDestRegionCode(string $value)
|
83 |
+
* @method string getDestRegionCode()
|
84 |
+
* @method Mage_Shipping_Model_Rate_Request setDestPostcode(string $value)
|
85 |
+
* @method string getDestPostcode()
|
86 |
+
* @method Mage_Shipping_Model_Rate_Request setDestCity(string $value)
|
87 |
+
* @method string getDestCity()
|
88 |
+
* @method Mage_Shipping_Model_Rate_Request setDestStreet(string $value)
|
89 |
+
* @method string getDestStreet()
|
90 |
+
*
|
91 |
+
* @method Mage_Shipping_Model_Rate_Request setPackageValue(float $value)
|
92 |
+
* @method float getPackageValue()
|
93 |
+
* @method Mage_Shipping_Model_Rate_Request setPackageValueWithDiscount(float $value)
|
94 |
+
* @method float getPackageValueWithDiscount()
|
95 |
+
* @method Mage_Shipping_Model_Rate_Request setPackagePhysicalValue(float $value)
|
96 |
+
* @method float getPackagePhysicalValue()
|
97 |
+
* @method Mage_Shipping_Model_Rate_Request setPackageQty(float $value)
|
98 |
+
* @method float getPackageQty()
|
99 |
+
* @method Mage_Shipping_Model_Rate_Request setPackageWeight(float $value)
|
100 |
+
* @method float getPackageWeight()
|
101 |
+
* @method Mage_Shipping_Model_Rate_Request setPackageHeight(int $value)
|
102 |
+
* @method int getPackageHeight()
|
103 |
+
* @method Mage_Shipping_Model_Rate_Request setPackageWidth(int $value)
|
104 |
+
* @method int getPackageWidth()
|
105 |
+
* @method Mage_Shipping_Model_Rate_Request setPackageDepth(int $value)
|
106 |
+
* @method int getPackageDepth()
|
107 |
+
* @method Mage_Shipping_Model_Rate_Request setPackageCurrency(string $value)
|
108 |
+
* @method string getPackageCurrency()
|
109 |
+
*
|
110 |
+
* @method Mage_Shipping_Model_Rate_Request setOrderTotalQty(float $value)
|
111 |
+
* @method float getOrderTotalQty()
|
112 |
+
* @method Mage_Shipping_Model_Rate_Request setOrderSubtotal(float $value)
|
113 |
+
* @method float getOrderSubtotal()
|
114 |
+
*
|
115 |
+
* @method boolean getFreeShipping()
|
116 |
+
* @method Mage_Shipping_Model_Rate_Request setFreeShipping(boolean $flag)
|
117 |
+
* @method float getFreeMethodWeight()
|
118 |
+
* @method Mage_Shipping_Model_Rate_Request setFreeMethodWeight(float $value)
|
119 |
+
*
|
120 |
+
* @method Mage_Shipping_Model_Rate_Request setOptionInsurance(boolean $value)
|
121 |
+
* @method boolean getOptionInsurance()
|
122 |
+
* @method Mage_Shipping_Model_Rate_Request setOptionHandling(float $flag)
|
123 |
+
* @method float getOptionHandling()
|
124 |
+
*
|
125 |
+
* @method Mage_Shipping_Model_Rate_Request setConditionName(array $value)
|
126 |
+
* @method Mage_Shipping_Model_Rate_Request setConditionName(string $value)
|
127 |
+
* @method string getConditionName()
|
128 |
+
* @method array getConditionName()
|
129 |
+
*
|
130 |
+
* @method Mage_Shipping_Model_Rate_Request setLimitCarrier(string $value)
|
131 |
+
* @method string getLimitCarrier()
|
132 |
+
* @method Mage_Shipping_Model_Rate_Request setLimitMethod(string $value)
|
133 |
+
* @method string getLimitMethod()
|
134 |
+
*
|
135 |
+
* @category Mage
|
136 |
+
* @package Mage_Shipping
|
137 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
138 |
+
*/
|
139 |
+
class Mage_Shipping_Model_Rate_Request extends Varien_Object
|
140 |
+
{}
|
app/code/local/Mage/Shipping/Model/Rate/Result.php
ADDED
@@ -0,0 +1,218 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
class Mage_Shipping_Model_Rate_Result
|
29 |
+
{
|
30 |
+
/**
|
31 |
+
* Shippin method rates
|
32 |
+
*
|
33 |
+
* @var array
|
34 |
+
*/
|
35 |
+
protected $_rates = array();
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Shipping errors
|
39 |
+
*
|
40 |
+
* @var null|bool
|
41 |
+
*/
|
42 |
+
protected $_error = null;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Reset result
|
46 |
+
*
|
47 |
+
* @return Mage_Shipping_Model_Rate_Result
|
48 |
+
*/
|
49 |
+
public function reset()
|
50 |
+
{
|
51 |
+
$this->_rates = array();
|
52 |
+
return $this;
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Set Error
|
57 |
+
*
|
58 |
+
* @param bool $error
|
59 |
+
* @return void
|
60 |
+
*/
|
61 |
+
public function setError($error)
|
62 |
+
{
|
63 |
+
$this->_error = $error;
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Get Error
|
68 |
+
*
|
69 |
+
* @return null|bool;
|
70 |
+
*/
|
71 |
+
public function getError()
|
72 |
+
{
|
73 |
+
return $this->_error;
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Add a rate to the result
|
78 |
+
*
|
79 |
+
* @param Mage_Shipping_Model_Rate_Result_Abstract|Mage_Shipping_Model_Rate_Result $result
|
80 |
+
* @return Mage_Shipping_Model_Rate_Result
|
81 |
+
*/
|
82 |
+
public function append($result)
|
83 |
+
{
|
84 |
+
if ($result instanceof Mage_Shipping_Model_Rate_Result_Error) {
|
85 |
+
$this->setError(true);
|
86 |
+
}
|
87 |
+
if ($result instanceof Mage_Shipping_Model_Rate_Result_Abstract) {
|
88 |
+
$this->_rates[] = $result;
|
89 |
+
}
|
90 |
+
elseif ($result instanceof Mage_Shipping_Model_Rate_Result) {
|
91 |
+
$rates = $result->getAllRates();
|
92 |
+
foreach ($rates as $rate) {
|
93 |
+
$this->append($rate);
|
94 |
+
}
|
95 |
+
}
|
96 |
+
return $this;
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Return all quotes in the result
|
101 |
+
*
|
102 |
+
* @return array
|
103 |
+
*/
|
104 |
+
public function getAllRates()
|
105 |
+
{
|
106 |
+
return $this->_rates;
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Return rate by id in array
|
111 |
+
*
|
112 |
+
* @param int $id
|
113 |
+
* @return Mage_Shipping_Model_Rate_Result_Method|null
|
114 |
+
*/
|
115 |
+
public function getRateById($id)
|
116 |
+
{
|
117 |
+
return isset($this->_rates[$id]) ? $this->_rates[$id] : null;
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Return quotes for specified type
|
122 |
+
*
|
123 |
+
* @param string $carrier
|
124 |
+
* @return array
|
125 |
+
*/
|
126 |
+
public function getRatesByCarrier($carrier)
|
127 |
+
{
|
128 |
+
$result = array();
|
129 |
+
foreach ($this->_rates as $rate) {
|
130 |
+
if ($rate->getCarrier() === $carrier) {
|
131 |
+
$result[] = $rate;
|
132 |
+
}
|
133 |
+
}
|
134 |
+
return $result;
|
135 |
+
}
|
136 |
+
|
137 |
+
/**
|
138 |
+
* Converts object to array
|
139 |
+
*
|
140 |
+
* @return array
|
141 |
+
*/
|
142 |
+
public function asArray()
|
143 |
+
{
|
144 |
+
$currencyFilter = Mage::app()->getStore()->getPriceFilter();
|
145 |
+
$rates = array();
|
146 |
+
$allRates = $this->getAllRates();
|
147 |
+
foreach ($allRates as $rate) {
|
148 |
+
$rates[$rate->getCarrier()]['title'] = $rate->getCarrierTitle();
|
149 |
+
$rates[$rate->getCarrier()]['methods'][$rate->getMethod()] = array(
|
150 |
+
'title' => $rate->getMethodTitle(),
|
151 |
+
'price' => $rate->getPrice(),
|
152 |
+
'price_formatted' => $currencyFilter->filter($rate->getPrice()),
|
153 |
+
);
|
154 |
+
}
|
155 |
+
return $rates;
|
156 |
+
}
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Get cheapest rate
|
160 |
+
*
|
161 |
+
* @return null|Mage_Shipping_Model_Rate_Result_Method
|
162 |
+
*/
|
163 |
+
public function getCheapestRate()
|
164 |
+
{
|
165 |
+
$cheapest = null;
|
166 |
+
$minPrice = 100000;
|
167 |
+
foreach ($this->getAllRates() as $rate) {
|
168 |
+
if (is_numeric($rate->getPrice()) && $rate->getPrice() < $minPrice) {
|
169 |
+
$cheapest = $rate;
|
170 |
+
$minPrice = $rate->getPrice();
|
171 |
+
}
|
172 |
+
}
|
173 |
+
return $cheapest;
|
174 |
+
}
|
175 |
+
|
176 |
+
/**
|
177 |
+
* Sort rates by price from min to max
|
178 |
+
*
|
179 |
+
* @return Mage_Shipping_Model_Rate_Result
|
180 |
+
*/
|
181 |
+
public function sortRatesByPrice()
|
182 |
+
{
|
183 |
+
if (!is_array($this->_rates) || !count($this->_rates)) {
|
184 |
+
return $this;
|
185 |
+
}
|
186 |
+
/* @var $rate Mage_Shipping_Model_Rate_Result_Method */
|
187 |
+
foreach ($this->_rates as $i => $rate) {
|
188 |
+
$tmp[$i] = $rate->getPrice();
|
189 |
+
}
|
190 |
+
|
191 |
+
natsort($tmp);
|
192 |
+
|
193 |
+
foreach ($tmp as $i => $price) {
|
194 |
+
$result[] = $this->_rates[$i];
|
195 |
+
}
|
196 |
+
|
197 |
+
$this->reset();
|
198 |
+
$this->_rates = $result;
|
199 |
+
return $this;
|
200 |
+
}
|
201 |
+
|
202 |
+
/**
|
203 |
+
* Set price for each rate according to count of packages
|
204 |
+
*
|
205 |
+
* @param int $packageCount
|
206 |
+
* @return Mage_Shipping_Model_Rate_Result
|
207 |
+
*/
|
208 |
+
public function updateRatePrice($packageCount)
|
209 |
+
{
|
210 |
+
if ($packageCount > 1) {
|
211 |
+
foreach ($this->_rates as $rate) {
|
212 |
+
$rate->setPrice($rate->getPrice() * $packageCount);
|
213 |
+
}
|
214 |
+
}
|
215 |
+
|
216 |
+
return $this;
|
217 |
+
}
|
218 |
+
}
|
app/code/local/Mage/Shipping/Model/Rate/Result/Abstract.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
class Mage_Shipping_Model_Rate_Result_Abstract extends Varien_Object
|
29 |
+
{
|
30 |
+
|
31 |
+
}
|
app/code/local/Mage/Shipping/Model/Rate/Result/Error.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
class Mage_Shipping_Model_Rate_Result_Error extends Mage_Shipping_Model_Rate_Result_Abstract
|
29 |
+
{
|
30 |
+
|
31 |
+
public function getErrorMessage()
|
32 |
+
{
|
33 |
+
if (!$this->getData('error_message')) {
|
34 |
+
$this->setData('error_message', Mage::helper('shipping')->__('This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.'));
|
35 |
+
}
|
36 |
+
return $this->getData('error_message');
|
37 |
+
}
|
38 |
+
}
|
app/code/local/Mage/Shipping/Model/Rate/Result/Method.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Fields:
|
30 |
+
* - carrier: ups
|
31 |
+
* - carrierTitle: United Parcel Service
|
32 |
+
* - method: 2day
|
33 |
+
* - methodTitle: UPS 2nd Day Priority
|
34 |
+
* - price: $9.40 (cost+handling)
|
35 |
+
* - cost: $8.00
|
36 |
+
*/
|
37 |
+
class Mage_Shipping_Model_Rate_Result_Method extends Mage_Shipping_Model_Rate_Result_Abstract
|
38 |
+
{
|
39 |
+
/**
|
40 |
+
* Round shipping carrier's method price
|
41 |
+
*
|
42 |
+
* @param string|float|int $price
|
43 |
+
* @return Mage_Shipping_Model_Rate_Result_Method
|
44 |
+
*/
|
45 |
+
public function setPrice($price)
|
46 |
+
{
|
47 |
+
$this->setData('price', Mage::app()->getStore()->roundPrice($price));
|
48 |
+
return $this;
|
49 |
+
}
|
50 |
+
}
|
app/code/local/Mage/Shipping/Model/Resource/Carrier/Tablerate.php
ADDED
@@ -0,0 +1,471 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Shipping table rates
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_Shipping
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_Shipping_Model_Resource_Carrier_Tablerate extends Mage_Core_Model_Resource_Db_Abstract
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Import table rates website ID
|
38 |
+
*
|
39 |
+
* @var int
|
40 |
+
*/
|
41 |
+
protected $_importWebsiteId = 0;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Errors in import process
|
45 |
+
*
|
46 |
+
* @var array
|
47 |
+
*/
|
48 |
+
protected $_importErrors = array();
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Count of imported table rates
|
52 |
+
*
|
53 |
+
* @var int
|
54 |
+
*/
|
55 |
+
protected $_importedRows = 0;
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Array of unique table rate keys to protect from duplicates
|
59 |
+
*
|
60 |
+
* @var array
|
61 |
+
*/
|
62 |
+
protected $_importUniqueHash = array();
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Array of countries keyed by iso2 code
|
66 |
+
*
|
67 |
+
* @var array
|
68 |
+
*/
|
69 |
+
protected $_importIso2Countries;
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Array of countries keyed by iso3 code
|
73 |
+
*
|
74 |
+
* @var array
|
75 |
+
*/
|
76 |
+
protected $_importIso3Countries;
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Associative array of countries and regions
|
80 |
+
* [country_id][region_code] = region_id
|
81 |
+
*
|
82 |
+
* @var array
|
83 |
+
*/
|
84 |
+
protected $_importRegions;
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Import Table Rate condition name
|
88 |
+
*
|
89 |
+
* @var string
|
90 |
+
*/
|
91 |
+
protected $_importConditionName;
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Array of condition full names
|
95 |
+
*
|
96 |
+
* @var array
|
97 |
+
*/
|
98 |
+
protected $_conditionFullNames = array();
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Define main table and id field name
|
102 |
+
*
|
103 |
+
* @return void
|
104 |
+
*/
|
105 |
+
protected function _construct()
|
106 |
+
{
|
107 |
+
$this->_init('shipping/tablerate', 'pk');
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Return table rate array or false by rate request
|
112 |
+
*
|
113 |
+
* @param Mage_Shipping_Model_Rate_Request $request
|
114 |
+
* @return array|boolean
|
115 |
+
*/
|
116 |
+
public function getRate(Mage_Shipping_Model_Rate_Request $request)
|
117 |
+
{
|
118 |
+
$adapter = $this->_getReadAdapter();
|
119 |
+
$bind = array(
|
120 |
+
':website_id' => (int) $request->getWebsiteId(),
|
121 |
+
':country_id' => $request->getDestCountryId(),
|
122 |
+
':region_id' => (int) $request->getDestRegionId(),
|
123 |
+
':postcode' => $request->getDestPostcode()
|
124 |
+
);
|
125 |
+
$select = $adapter->select()
|
126 |
+
->from($this->getMainTable())
|
127 |
+
->where('website_id = :website_id')
|
128 |
+
->order(array('dest_country_id DESC', 'dest_region_id DESC', 'dest_zip DESC', 'condition_value DESC'))
|
129 |
+
->limit(1);
|
130 |
+
|
131 |
+
// Render destination condition
|
132 |
+
$orWhere = '(' . implode(') OR (', array(
|
133 |
+
"dest_country_id = :country_id AND dest_region_id = :region_id AND dest_zip = :postcode",
|
134 |
+
"dest_country_id = :country_id AND dest_region_id = :region_id AND dest_zip = ''",
|
135 |
+
|
136 |
+
// Handle asterix in dest_zip field
|
137 |
+
"dest_country_id = :country_id AND dest_region_id = :region_id AND dest_zip = '*'",
|
138 |
+
"dest_country_id = :country_id AND dest_region_id = 0 AND dest_zip = '*'",
|
139 |
+
"dest_country_id = '0' AND dest_region_id = :region_id AND dest_zip = '*'",
|
140 |
+
"dest_country_id = '0' AND dest_region_id = 0 AND dest_zip = '*'",
|
141 |
+
|
142 |
+
"dest_country_id = :country_id AND dest_region_id = 0 AND dest_zip = ''",
|
143 |
+
"dest_country_id = :country_id AND dest_region_id = 0 AND dest_zip = :postcode",
|
144 |
+
"dest_country_id = :country_id AND dest_region_id = 0 AND dest_zip = '*'",
|
145 |
+
)) . ')';
|
146 |
+
$select->where($orWhere);
|
147 |
+
|
148 |
+
// Render condition by condition name
|
149 |
+
if (is_array($request->getConditionName())) {
|
150 |
+
$orWhere = array();
|
151 |
+
$i = 0;
|
152 |
+
foreach ($request->getConditionName() as $conditionName) {
|
153 |
+
$bindNameKey = sprintf(':condition_name_%d', $i);
|
154 |
+
$bindValueKey = sprintf(':condition_value_%d', $i);
|
155 |
+
$orWhere[] = "(condition_name = {$bindNameKey} AND condition_value <= {$bindValueKey})";
|
156 |
+
$bind[$bindNameKey] = $conditionName;
|
157 |
+
$bind[$bindValueKey] = $request->getData($conditionName);
|
158 |
+
$i++;
|
159 |
+
}
|
160 |
+
|
161 |
+
if ($orWhere) {
|
162 |
+
$select->where(implode(' OR ', $orWhere));
|
163 |
+
}
|
164 |
+
} else {
|
165 |
+
$bind[':condition_name'] = $request->getConditionName();
|
166 |
+
$bind[':condition_value'] = $request->getData($request->getConditionName());
|
167 |
+
|
168 |
+
$select->where('condition_name = :condition_name');
|
169 |
+
$select->where('condition_value <= :condition_value');
|
170 |
+
}
|
171 |
+
|
172 |
+
$result = $adapter->fetchRow($select, $bind);
|
173 |
+
// Normalize destination zip code
|
174 |
+
if ($result && $result['dest_zip'] == '*') {
|
175 |
+
$result['dest_zip'] = '';
|
176 |
+
}
|
177 |
+
return $result;
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* Upload table rate file and import data from it
|
182 |
+
*
|
183 |
+
* @param Varien_Object $object
|
184 |
+
* @throws Mage_Core_Exception
|
185 |
+
* @return Mage_Shipping_Model_Resource_Carrier_Tablerate
|
186 |
+
*/
|
187 |
+
public function uploadAndImport(Varien_Object $object)
|
188 |
+
{
|
189 |
+
if (empty($_FILES['groups']['tmp_name']['tablerate']['fields']['import']['value'])) {
|
190 |
+
return $this;
|
191 |
+
}
|
192 |
+
|
193 |
+
$csvFile = $_FILES['groups']['tmp_name']['tablerate']['fields']['import']['value'];
|
194 |
+
$website = Mage::app()->getWebsite($object->getScopeId());
|
195 |
+
|
196 |
+
$this->_importWebsiteId = (int)$website->getId();
|
197 |
+
$this->_importUniqueHash = array();
|
198 |
+
$this->_importErrors = array();
|
199 |
+
$this->_importedRows = 0;
|
200 |
+
|
201 |
+
$io = new Varien_Io_File();
|
202 |
+
$info = pathinfo($csvFile);
|
203 |
+
$io->open(array('path' => $info['dirname']));
|
204 |
+
$io->streamOpen($info['basename'], 'r');
|
205 |
+
|
206 |
+
// check and skip headers
|
207 |
+
$headers = $io->streamReadCsv();
|
208 |
+
if ($headers === false || count($headers) < 5) {
|
209 |
+
$io->streamClose();
|
210 |
+
Mage::throwException(Mage::helper('shipping')->__('Invalid Table Rates File Format'));
|
211 |
+
}
|
212 |
+
|
213 |
+
if ($object->getData('groups/tablerate/fields/condition_name/inherit') == '1') {
|
214 |
+
$conditionName = (string)Mage::getConfig()->getNode('default/carriers/tablerate/condition_name');
|
215 |
+
} else {
|
216 |
+
$conditionName = $object->getData('groups/tablerate/fields/condition_name/value');
|
217 |
+
}
|
218 |
+
$this->_importConditionName = $conditionName;
|
219 |
+
|
220 |
+
$adapter = $this->_getWriteAdapter();
|
221 |
+
$adapter->beginTransaction();
|
222 |
+
|
223 |
+
try {
|
224 |
+
$rowNumber = 1;
|
225 |
+
$importData = array();
|
226 |
+
|
227 |
+
$this->_loadDirectoryCountries();
|
228 |
+
$this->_loadDirectoryRegions();
|
229 |
+
|
230 |
+
// delete old data by website and condition name
|
231 |
+
$condition = array(
|
232 |
+
'website_id = ?' => $this->_importWebsiteId,
|
233 |
+
'condition_name = ?' => $this->_importConditionName
|
234 |
+
);
|
235 |
+
$adapter->delete($this->getMainTable(), $condition);
|
236 |
+
|
237 |
+
while (false !== ($csvLine = $io->streamReadCsv())) {
|
238 |
+
$rowNumber ++;
|
239 |
+
|
240 |
+
if (empty($csvLine)) {
|
241 |
+
continue;
|
242 |
+
}
|
243 |
+
|
244 |
+
$row = $this->_getImportRow($csvLine, $rowNumber);
|
245 |
+
if ($row !== false) {
|
246 |
+
$importData[] = $row;
|
247 |
+
}
|
248 |
+
|
249 |
+
if (count($importData) == 5000) {
|
250 |
+
$this->_saveImportData($importData);
|
251 |
+
$importData = array();
|
252 |
+
}
|
253 |
+
}
|
254 |
+
$this->_saveImportData($importData);
|
255 |
+
$io->streamClose();
|
256 |
+
} catch (Mage_Core_Exception $e) {
|
257 |
+
$adapter->rollback();
|
258 |
+
$io->streamClose();
|
259 |
+
Mage::throwException($e->getMessage());
|
260 |
+
} catch (Exception $e) {
|
261 |
+
$adapter->rollback();
|
262 |
+
$io->streamClose();
|
263 |
+
Mage::logException($e);
|
264 |
+
Mage::throwException(Mage::helper('shipping')->__('An error occurred while import table rates.'));
|
265 |
+
}
|
266 |
+
|
267 |
+
$adapter->commit();
|
268 |
+
|
269 |
+
if ($this->_importErrors) {
|
270 |
+
$error = Mage::helper('shipping')->__('File has not been imported. See the following list of errors: %s', implode(" \n", $this->_importErrors));
|
271 |
+
Mage::throwException($error);
|
272 |
+
}
|
273 |
+
|
274 |
+
return $this;
|
275 |
+
}
|
276 |
+
|
277 |
+
/**
|
278 |
+
* Load directory countries
|
279 |
+
*
|
280 |
+
* @return Mage_Shipping_Model_Resource_Carrier_Tablerate
|
281 |
+
*/
|
282 |
+
protected function _loadDirectoryCountries()
|
283 |
+
{
|
284 |
+
if (!is_null($this->_importIso2Countries) && !is_null($this->_importIso3Countries)) {
|
285 |
+
return $this;
|
286 |
+
}
|
287 |
+
|
288 |
+
$this->_importIso2Countries = array();
|
289 |
+
$this->_importIso3Countries = array();
|
290 |
+
|
291 |
+
/** @var $collection Mage_Directory_Model_Resource_Country_Collection */
|
292 |
+
$collection = Mage::getResourceModel('directory/country_collection');
|
293 |
+
foreach ($collection->getData() as $row) {
|
294 |
+
$this->_importIso2Countries[$row['iso2_code']] = $row['country_id'];
|
295 |
+
$this->_importIso3Countries[$row['iso3_code']] = $row['country_id'];
|
296 |
+
}
|
297 |
+
|
298 |
+
return $this;
|
299 |
+
}
|
300 |
+
|
301 |
+
/**
|
302 |
+
* Load directory regions
|
303 |
+
*
|
304 |
+
* @return Mage_Shipping_Model_Resource_Carrier_Tablerate
|
305 |
+
*/
|
306 |
+
protected function _loadDirectoryRegions()
|
307 |
+
{
|
308 |
+
if (!is_null($this->_importRegions)) {
|
309 |
+
return $this;
|
310 |
+
}
|
311 |
+
|
312 |
+
$this->_importRegions = array();
|
313 |
+
|
314 |
+
/** @var $collection Mage_Directory_Model_Resource_Region_Collection */
|
315 |
+
$collection = Mage::getResourceModel('directory/region_collection');
|
316 |
+
foreach ($collection->getData() as $row) {
|
317 |
+
$this->_importRegions[$row['country_id']][$row['code']] = (int)$row['region_id'];
|
318 |
+
}
|
319 |
+
|
320 |
+
return $this;
|
321 |
+
}
|
322 |
+
|
323 |
+
/**
|
324 |
+
* Return import condition full name by condition name code
|
325 |
+
*
|
326 |
+
* @param string $conditionName
|
327 |
+
* @return string
|
328 |
+
*/
|
329 |
+
protected function _getConditionFullName($conditionName)
|
330 |
+
{
|
331 |
+
if (!isset($this->_conditionFullNames[$conditionName])) {
|
332 |
+
$name = Mage::getSingleton('shipping/carrier_tablerate')->getCode('condition_name_short', $conditionName);
|
333 |
+
$this->_conditionFullNames[$conditionName] = $name;
|
334 |
+
}
|
335 |
+
|
336 |
+
return $this->_conditionFullNames[$conditionName];
|
337 |
+
}
|
338 |
+
|
339 |
+
/**
|
340 |
+
* Validate row for import and return table rate array or false
|
341 |
+
* Error will be add to _importErrors array
|
342 |
+
*
|
343 |
+
* @param array $row
|
344 |
+
* @param int $rowNumber
|
345 |
+
* @return array|false
|
346 |
+
*/
|
347 |
+
protected function _getImportRow($row, $rowNumber = 0)
|
348 |
+
{
|
349 |
+
// validate row
|
350 |
+
if (count($row) < 5) {
|
351 |
+
$this->_importErrors[] = Mage::helper('shipping')->__('Invalid Table Rates format in the Row #%s', $rowNumber);
|
352 |
+
return false;
|
353 |
+
}
|
354 |
+
|
355 |
+
// strip whitespace from the beginning and end of each row
|
356 |
+
foreach ($row as $k => $v) {
|
357 |
+
$row[$k] = trim($v);
|
358 |
+
}
|
359 |
+
|
360 |
+
// validate country
|
361 |
+
if (isset($this->_importIso2Countries[$row[0]])) {
|
362 |
+
$countryId = $this->_importIso2Countries[$row[0]];
|
363 |
+
} elseif (isset($this->_importIso3Countries[$row[0]])) {
|
364 |
+
$countryId = $this->_importIso3Countries[$row[0]];
|
365 |
+
} elseif ($row[0] == '*' || $row[0] == '') {
|
366 |
+
$countryId = '0';
|
367 |
+
} else {
|
368 |
+
$this->_importErrors[] = Mage::helper('shipping')->__('Invalid Country "%s" in the Row #%s.', $row[0], $rowNumber);
|
369 |
+
return false;
|
370 |
+
}
|
371 |
+
|
372 |
+
// validate region
|
373 |
+
if ($countryId != '0' && isset($this->_importRegions[$countryId][$row[1]])) {
|
374 |
+
$regionId = $this->_importRegions[$countryId][$row[1]];
|
375 |
+
} elseif ($row[1] == '*' || $row[1] == '') {
|
376 |
+
$regionId = 0;
|
377 |
+
} else {
|
378 |
+
$this->_importErrors[] = Mage::helper('shipping')->__('Invalid Region/State "%s" in the Row #%s.', $row[1], $rowNumber);
|
379 |
+
return false;
|
380 |
+
}
|
381 |
+
|
382 |
+
// detect zip code
|
383 |
+
if ($row[2] == '*' || $row[2] == '') {
|
384 |
+
$zipCode = '*';
|
385 |
+
} else {
|
386 |
+
$zipCode = $row[2];
|
387 |
+
}
|
388 |
+
|
389 |
+
// validate condition value
|
390 |
+
$value = $this->_parseDecimalValue($row[3]);
|
391 |
+
if ($value === false) {
|
392 |
+
$this->_importErrors[] = Mage::helper('shipping')->__('Invalid %s "%s" in the Row #%s.', $this->_getConditionFullName($this->_importConditionName), $row[3], $rowNumber);
|
393 |
+
return false;
|
394 |
+
}
|
395 |
+
|
396 |
+
// validate price
|
397 |
+
$price = $this->_parseDecimalValue($row[4]);
|
398 |
+
if ($price === false) {
|
399 |
+
$this->_importErrors[] = Mage::helper('shipping')->__('Invalid Shipping Price "%s" in the Row #%s.', $row[4], $rowNumber);
|
400 |
+
return false;
|
401 |
+
}
|
402 |
+
|
403 |
+
// protect from duplicate
|
404 |
+
$hash = sprintf("%s-%d-%s-%F", $countryId, $regionId, $zipCode, $value);
|
405 |
+
if (isset($this->_importUniqueHash[$hash])) {
|
406 |
+
$this->_importErrors[] = Mage::helper('shipping')->__('Duplicate Row #%s (Country "%s", Region/State "%s", Zip "%s" and Value "%s").', $rowNumber, $row[0], $row[1], $zipCode, $value);
|
407 |
+
return false;
|
408 |
+
}
|
409 |
+
$this->_importUniqueHash[$hash] = true;
|
410 |
+
|
411 |
+
return array(
|
412 |
+
$this->_importWebsiteId, // website_id
|
413 |
+
$countryId, // dest_country_id
|
414 |
+
$regionId, // dest_region_id,
|
415 |
+
$zipCode, // dest_zip
|
416 |
+
$this->_importConditionName,// condition_name,
|
417 |
+
$value, // condition_value
|
418 |
+
$price // price
|
419 |
+
);
|
420 |
+
}
|
421 |
+
|
422 |
+
/**
|
423 |
+
* Save import data batch
|
424 |
+
*
|
425 |
+
* @param array $data
|
426 |
+
* @return Mage_Shipping_Model_Resource_Carrier_Tablerate
|
427 |
+
*/
|
428 |
+
protected function _saveImportData(array $data)
|
429 |
+
{
|
430 |
+
if (!empty($data)) {
|
431 |
+
$columns = array('website_id', 'dest_country_id', 'dest_region_id', 'dest_zip',
|
432 |
+
'condition_name', 'condition_value', 'price');
|
433 |
+
$this->_getWriteAdapter()->insertArray($this->getMainTable(), $columns, $data);
|
434 |
+
$this->_importedRows += count($data);
|
435 |
+
}
|
436 |
+
|
437 |
+
return $this;
|
438 |
+
}
|
439 |
+
|
440 |
+
/**
|
441 |
+
* Parse and validate positive decimal value
|
442 |
+
* Return false if value is not decimal or is not positive
|
443 |
+
*
|
444 |
+
* @param string $value
|
445 |
+
* @return bool|float
|
446 |
+
*/
|
447 |
+
protected function _parseDecimalValue($value)
|
448 |
+
{
|
449 |
+
if (!is_numeric($value)) {
|
450 |
+
return false;
|
451 |
+
}
|
452 |
+
$value = (float)sprintf('%.4F', $value);
|
453 |
+
if ($value < 0.0000) {
|
454 |
+
return false;
|
455 |
+
}
|
456 |
+
return $value;
|
457 |
+
}
|
458 |
+
|
459 |
+
/**
|
460 |
+
* Parse and validate positive decimal value
|
461 |
+
*
|
462 |
+
* @see self::_parseDecimalValue()
|
463 |
+
* @deprecated since 1.4.1.0
|
464 |
+
* @param string $value
|
465 |
+
* @return bool|float
|
466 |
+
*/
|
467 |
+
protected function _isPositiveDecimalNumber($value)
|
468 |
+
{
|
469 |
+
return $this->_parseDecimalValue($value);
|
470 |
+
}
|
471 |
+
}
|
app/code/local/Mage/Shipping/Model/Resource/Carrier/Tablerate/Collection.php
ADDED
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Shipping table rates collection
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_Shipping
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_Shipping_Model_Resource_Carrier_Tablerate_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* main table name
|
38 |
+
*
|
39 |
+
* @deprecated since 1.4.1.0
|
40 |
+
* @var string
|
41 |
+
*/
|
42 |
+
protected $_shipTable;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* directory/country table name
|
46 |
+
*
|
47 |
+
* @var string
|
48 |
+
*/
|
49 |
+
protected $_countryTable;
|
50 |
+
|
51 |
+
/**
|
52 |
+
* directory/country_region table name
|
53 |
+
*
|
54 |
+
* @var string
|
55 |
+
*/
|
56 |
+
protected $_regionTable;
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Define resource model and item
|
60 |
+
*
|
61 |
+
*/
|
62 |
+
protected function _construct()
|
63 |
+
{
|
64 |
+
$this->_init('shipping/carrier_tablerate');
|
65 |
+
$this->_shipTable = $this->getMainTable();
|
66 |
+
$this->_countryTable = $this->getTable('directory/country');
|
67 |
+
$this->_regionTable = $this->getTable('directory/country_region');
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Initialize select, add country iso3 code and region name
|
72 |
+
*
|
73 |
+
* @return void
|
74 |
+
*/
|
75 |
+
public function _initSelect()
|
76 |
+
{
|
77 |
+
parent::_initSelect();
|
78 |
+
|
79 |
+
$this->_select
|
80 |
+
->joinLeft(
|
81 |
+
array('country_table' => $this->_countryTable),
|
82 |
+
'country_table.country_id = main_table.dest_country_id',
|
83 |
+
array('dest_country' => 'iso3_code'))
|
84 |
+
->joinLeft(
|
85 |
+
array('region_table' => $this->_regionTable),
|
86 |
+
'region_table.region_id = main_table.dest_region_id',
|
87 |
+
array('dest_region' => 'code'));
|
88 |
+
|
89 |
+
$this->addOrder('dest_country', self::SORT_ORDER_ASC);
|
90 |
+
$this->addOrder('dest_region', self::SORT_ORDER_ASC);
|
91 |
+
$this->addOrder('dest_zip', self::SORT_ORDER_ASC);
|
92 |
+
$this->addOrder('condition_value', self::SORT_ORDER_ASC);
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Add website filter to collection
|
97 |
+
*
|
98 |
+
* @param int $websiteId
|
99 |
+
* @return Mage_Shipping_Model_Resource_Carrier_Tablerate_Collection
|
100 |
+
*/
|
101 |
+
public function setWebsiteFilter($websiteId)
|
102 |
+
{
|
103 |
+
return $this->addFieldToFilter('website_id', $websiteId);
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Add condition name (code) filter to collection
|
108 |
+
*
|
109 |
+
* @param string $conditionName
|
110 |
+
* @return Mage_Shipping_Model_Resource_Carrier_Tablerate_Collection
|
111 |
+
*/
|
112 |
+
public function setConditionFilter($conditionName)
|
113 |
+
{
|
114 |
+
return $this->addFieldToFilter('condition_name', $conditionName);
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Add country filter to collection
|
119 |
+
*
|
120 |
+
* @param string $countryId
|
121 |
+
* @return Mage_Shipping_Model_Resource_Carrier_Tablerate_Collection
|
122 |
+
*/
|
123 |
+
public function setCountryFilter($countryId)
|
124 |
+
{
|
125 |
+
return $this->addFieldToFilter('dest_country_id', $countryId);
|
126 |
+
}
|
127 |
+
}
|
app/code/local/Mage/Shipping/Model/Shipment/Request.php
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @method Mage_Shipping_Model_Shipment_Request setOrderShipment(Mage_Sales_Model_Order_Shipment $orderShipment)
|
29 |
+
* @method Mage_Sales_Model_Order_Shipment getOrderShipment()
|
30 |
+
* @method Mage_Shipping_Model_Shipment_Request setShipperContactPersonName(string $value)
|
31 |
+
* @method string getShipperContactPersonName()
|
32 |
+
* @method Mage_Shipping_Model_Shipment_Request setShipperContactPersonFirstName(string $value)
|
33 |
+
* @method string getShipperContactPersonFirstName()
|
34 |
+
* @method Mage_Shipping_Model_Shipment_Request setShipperContactPersonLastName(string $value)
|
35 |
+
* @method string getShipperContactPersonLastName()
|
36 |
+
* @method Mage_Shipping_Model_Shipment_Request setShipperContactCompanyName(string $value)
|
37 |
+
* @method string getShipperContactCompanyName()
|
38 |
+
* @method Mage_Shipping_Model_Shipment_Request setShipperContactPhoneNumber(int $value)
|
39 |
+
* @method int getShipperContactPhoneNumber()
|
40 |
+
* @method Mage_Shipping_Model_Shipment_Request setShipperAddressStreet(string $value)
|
41 |
+
* @method string getShipperAddressStreet()
|
42 |
+
* @method Mage_Shipping_Model_Shipment_Request setShipperAddressStreet1(string $value)
|
43 |
+
* @method string getShipperAddressStreet1()
|
44 |
+
* @method Mage_Shipping_Model_Shipment_Request setShipperAddressStreet2(string $value)
|
45 |
+
* @method string getShipperAddressStreet2()
|
46 |
+
* @method Mage_Shipping_Model_Shipment_Request setShipperAddressCity(string $value)
|
47 |
+
* @method string getShipperAddressCity()
|
48 |
+
* @method Mage_Shipping_Model_Shipment_Request setShipperAddressStateOrProvinceCode(string $value)
|
49 |
+
* @method string getShipperAddressStateOrProvinceCode()
|
50 |
+
* @method Mage_Shipping_Model_Shipment_Request setShipperAddressPostalCode(int $value)
|
51 |
+
* @method int getShipperAddressPostalCode()
|
52 |
+
* @method Mage_Shipping_Model_Shipment_Request setShipperAddressCountryCode(string $value)
|
53 |
+
* @method string getShipperAddressCountryCode()
|
54 |
+
* @method Mage_Shipping_Model_Shipment_Request setRecipientContactPersonName(string $value)
|
55 |
+
* @method string getRecipientContactPersonName()
|
56 |
+
* @method Mage_Shipping_Model_Shipment_Request setRecipientContactPersonFirstName(string $value)
|
57 |
+
* @method string getRecipientContactPersonFirstName()
|
58 |
+
* @method Mage_Shipping_Model_Shipment_Request setRecipientContactPersonLastName(string $value)
|
59 |
+
* @method string getRecipientContactPersonLastName()
|
60 |
+
* @method Mage_Shipping_Model_Shipment_Request setRecipientContactCompanyName(string $value)
|
61 |
+
* @method string getRecipientContactCompanyName()
|
62 |
+
* @method Mage_Shipping_Model_Shipment_Request setRecipientContactPhoneNumber(int $value)
|
63 |
+
* @method int getRecipientContactPhoneNumber()
|
64 |
+
* @method Mage_Shipping_Model_Shipment_Request setRecipientAddressStreet(string $value)
|
65 |
+
* @method string getRecipientAddressStreet()
|
66 |
+
* @method Mage_Shipping_Model_Shipment_Request setRecipientAddressStreet1(string $value)
|
67 |
+
* @method string getRecipientAddressStreet1()
|
68 |
+
* @method Mage_Shipping_Model_Shipment_Request setRecipientAddressStreet2(string $value)
|
69 |
+
* @method string getRecipientAddressStreet2()
|
70 |
+
* @method Mage_Shipping_Model_Shipment_Request setRecipientAddressCity(string $value)
|
71 |
+
* @method string getRecipientAddressCity()
|
72 |
+
* @method Mage_Shipping_Model_Shipment_Request setRecipientAddressStateOrProvinceCode(string $value)
|
73 |
+
* @method string getRecipientAddressStateOrProvinceCode()
|
74 |
+
* @method Mage_Shipping_Model_Shipment_Request setRecipientAddressPostalCode(int $value)
|
75 |
+
* @method int getRecipientAddressPostalCode()
|
76 |
+
* @method Mage_Shipping_Model_Shipment_Request setRecipientAddressCountryCode(string $value)
|
77 |
+
* @method string getRecipientAddressCountryCode()
|
78 |
+
* @method Mage_Shipping_Model_Shipment_Request setShippingMethod(string $value)
|
79 |
+
* @method string getShippingMethod()
|
80 |
+
* @method Mage_Shipping_Model_Shipment_Request setPackageWeight(float $value)
|
81 |
+
* @method float getPackageWeight()
|
82 |
+
*
|
83 |
+
* @category Mage
|
84 |
+
* @package Mage_Shipping
|
85 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
86 |
+
*/
|
87 |
+
class Mage_Shipping_Model_Shipment_Request extends Varien_Object
|
88 |
+
{
|
89 |
+
}
|
app/code/local/Mage/Shipping/Model/Shipment/Return.php
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @method Mage_Shipping_Model_Shipment_Request setOrderShipment(Mage_Sales_Model_Order_Shipment $orderShipment)
|
29 |
+
* @method Mage_Sales_Model_Order_Shipment getOrderShipment()
|
30 |
+
* @method Mage_Shipping_Model_Shipment_Request setShipperContactPersonName(string $value)
|
31 |
+
* @method string getShipperContactPersonName()
|
32 |
+
* @method Mage_Shipping_Model_Shipment_Request setShipperContactPersonFirstName(string $value)
|
33 |
+
* @method string getShipperContactPersonFirstName()
|
34 |
+
* @method Mage_Shipping_Model_Shipment_Request setShipperContactPersonLastName(string $value)
|
35 |
+
* @method string getShipperContactPersonLastName()
|
36 |
+
* @method Mage_Shipping_Model_Shipment_Request setShipperContactCompanyName(string $value)
|
37 |
+
* @method string getShipperContactCompanyName()
|
38 |
+
* @method Mage_Shipping_Model_Shipment_Request setShipperContactPhoneNumber(int $value)
|
39 |
+
* @method int getShipperContactPhoneNumber()
|
40 |
+
* @method Mage_Shipping_Model_Shipment_Request setShipperAddressStreet(string $value)
|
41 |
+
* @method string getShipperAddressStreet()
|
42 |
+
* @method Mage_Shipping_Model_Shipment_Request setShipperAddressStreet1(string $value)
|
43 |
+
* @method string getShipperAddressStreet1()
|
44 |
+
* @method Mage_Shipping_Model_Shipment_Request setShipperAddressStreet2(string $value)
|
45 |
+
* @method string getShipperAddressStreet2()
|
46 |
+
* @method Mage_Shipping_Model_Shipment_Request setShipperAddressCity(string $value)
|
47 |
+
* @method string getShipperAddressCity()
|
48 |
+
* @method Mage_Shipping_Model_Shipment_Request setShipperAddressStateOrProvinceCode(string $value)
|
49 |
+
* @method string getShipperAddressStateOrProvinceCode()
|
50 |
+
* @method Mage_Shipping_Model_Shipment_Request setShipperAddressPostalCode(int $value)
|
51 |
+
* @method int getShipperAddressPostalCode()
|
52 |
+
* @method Mage_Shipping_Model_Shipment_Request setShipperAddressCountryCode(string $value)
|
53 |
+
* @method string getShipperAddressCountryCode()
|
54 |
+
* @method Mage_Shipping_Model_Shipment_Request setRecipientContactPersonName(string $value)
|
55 |
+
* @method string getRecipientContactPersonName()
|
56 |
+
* @method Mage_Shipping_Model_Shipment_Request setRecipientContactPersonFirstName(string $value)
|
57 |
+
* @method string getRecipientContactPersonFirstName()
|
58 |
+
* @method Mage_Shipping_Model_Shipment_Request setRecipientContactPersonLastName(string $value)
|
59 |
+
* @method string getRecipientContactPersonLastName()
|
60 |
+
* @method Mage_Shipping_Model_Shipment_Request setRecipientContactCompanyName(string $value)
|
61 |
+
* @method string getRecipientContactCompanyName()
|
62 |
+
* @method Mage_Shipping_Model_Shipment_Request setRecipientContactPhoneNumber(int $value)
|
63 |
+
* @method int getRecipientContactPhoneNumber()
|
64 |
+
* @method Mage_Shipping_Model_Shipment_Request setRecipientAddressStreet(string $value)
|
65 |
+
* @method string getRecipientAddressStreet()
|
66 |
+
* @method Mage_Shipping_Model_Shipment_Request setRecipientAddressStreet1(string $value)
|
67 |
+
* @method string getRecipientAddressStreet1()
|
68 |
+
* @method Mage_Shipping_Model_Shipment_Request setRecipientAddressStreet2(string $value)
|
69 |
+
* @method string getRecipientAddressStreet2()
|
70 |
+
* @method Mage_Shipping_Model_Shipment_Request setRecipientAddressCity(string $value)
|
71 |
+
* @method string getRecipientAddressCity()
|
72 |
+
* @method Mage_Shipping_Model_Shipment_Request setRecipientAddressStateOrProvinceCode(string $value)
|
73 |
+
* @method string getRecipientAddressStateOrProvinceCode()
|
74 |
+
* @method Mage_Shipping_Model_Shipment_Request setRecipientAddressPostalCode(int $value)
|
75 |
+
* @method int getRecipientAddressPostalCode()
|
76 |
+
* @method Mage_Shipping_Model_Shipment_Request setRecipientAddressCountryCode(string $value)
|
77 |
+
* @method string getRecipientAddressCountryCode()
|
78 |
+
* @method Mage_Shipping_Model_Shipment_Request setShippingMethod(string $value)
|
79 |
+
* @method string getShippingMethod()
|
80 |
+
* @method Mage_Shipping_Model_Shipment_Request setPackageWeight(float $value)
|
81 |
+
* @method float getPackageWeight()
|
82 |
+
*
|
83 |
+
* @category Mage
|
84 |
+
* @package Mage_Shipping
|
85 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
86 |
+
*/
|
87 |
+
class Mage_Shipping_Model_Shipment_Return extends Varien_Object
|
88 |
+
{
|
89 |
+
}
|
app/code/local/Mage/Shipping/Model/Shipping.php
ADDED
@@ -0,0 +1,506 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
class Mage_Shipping_Model_Shipping
|
29 |
+
{
|
30 |
+
/**
|
31 |
+
* Store address
|
32 |
+
*/
|
33 |
+
const XML_PATH_STORE_ADDRESS1 = 'shipping/origin/street_line1';
|
34 |
+
const XML_PATH_STORE_ADDRESS2 = 'shipping/origin/street_line2';
|
35 |
+
const XML_PATH_STORE_CITY = 'shipping/origin/city';
|
36 |
+
const XML_PATH_STORE_REGION_ID = 'shipping/origin/region_id';
|
37 |
+
const XML_PATH_STORE_ZIP = 'shipping/origin/postcode';
|
38 |
+
const XML_PATH_STORE_COUNTRY_ID = 'shipping/origin/country_id';
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Default shipping orig for requests
|
42 |
+
*
|
43 |
+
* @var array
|
44 |
+
*/
|
45 |
+
protected $_orig = null;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Cached result
|
49 |
+
*
|
50 |
+
* @var Mage_Sales_Model_Shipping_Method_Result
|
51 |
+
*/
|
52 |
+
protected $_result = null;
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Part of carrier xml config path
|
56 |
+
*
|
57 |
+
* @var string
|
58 |
+
*/
|
59 |
+
protected $_availabilityConfigField = 'active';
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Get shipping rate result model
|
63 |
+
*
|
64 |
+
* @return Mage_Shipping_Model_Rate_Result
|
65 |
+
*/
|
66 |
+
public function getResult()
|
67 |
+
{
|
68 |
+
if (empty($this->_result)) {
|
69 |
+
$this->_result = Mage::getModel('shipping/rate_result');
|
70 |
+
}
|
71 |
+
return $this->_result;
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Set shipping orig data
|
76 |
+
*
|
77 |
+
* @param array $data
|
78 |
+
* @return null
|
79 |
+
*/
|
80 |
+
public function setOrigData($data)
|
81 |
+
{
|
82 |
+
$this->_orig = $data;
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Reset cached result
|
87 |
+
*
|
88 |
+
* @return Mage_Shipping_Model_Shipping
|
89 |
+
*/
|
90 |
+
public function resetResult()
|
91 |
+
{
|
92 |
+
$this->getResult()->reset();
|
93 |
+
return $this;
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Retrieve configuration model
|
98 |
+
*
|
99 |
+
* @return Mage_Shipping_Model_Config
|
100 |
+
*/
|
101 |
+
public function getConfig()
|
102 |
+
{
|
103 |
+
return Mage::getSingleton('shipping/config');
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Retrieve all methods for supplied shipping data
|
108 |
+
*
|
109 |
+
* @todo make it ordered
|
110 |
+
* @param Mage_Shipping_Model_Shipping_Method_Request $data
|
111 |
+
* @return Mage_Shipping_Model_Shipping
|
112 |
+
*/
|
113 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
114 |
+
{
|
115 |
+
$storeId = $request->getStoreId();
|
116 |
+
if (!$request->getOrig()) {
|
117 |
+
$request
|
118 |
+
->setCountryId(Mage::getStoreConfig(self::XML_PATH_STORE_COUNTRY_ID, $request->getStore()))
|
119 |
+
->setRegionId(Mage::getStoreConfig(self::XML_PATH_STORE_REGION_ID, $request->getStore()))
|
120 |
+
->setCity(Mage::getStoreConfig(self::XML_PATH_STORE_CITY, $request->getStore()))
|
121 |
+
->setPostcode(Mage::getStoreConfig(self::XML_PATH_STORE_ZIP, $request->getStore()));
|
122 |
+
}
|
123 |
+
|
124 |
+
$limitCarrier = $request->getLimitCarrier();
|
125 |
+
if (!$limitCarrier) {
|
126 |
+
$carriers = Mage::getStoreConfig('carriers', $storeId);
|
127 |
+
|
128 |
+
foreach ($carriers as $carrierCode => $carrierConfig) {
|
129 |
+
$this->collectCarrierRates($carrierCode, $request);
|
130 |
+
}
|
131 |
+
} else {
|
132 |
+
if (!is_array($limitCarrier)) {
|
133 |
+
$limitCarrier = array($limitCarrier);
|
134 |
+
}
|
135 |
+
foreach ($limitCarrier as $carrierCode) {
|
136 |
+
$carrierConfig = Mage::getStoreConfig('carriers/' . $carrierCode, $storeId);
|
137 |
+
if (!$carrierConfig) {
|
138 |
+
continue;
|
139 |
+
}
|
140 |
+
$this->collectCarrierRates($carrierCode, $request);
|
141 |
+
}
|
142 |
+
}
|
143 |
+
|
144 |
+
return $this;
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Collect rates of given carrier
|
149 |
+
*
|
150 |
+
* @param string $carrierCode
|
151 |
+
* @param Mage_Shipping_Model_Rate_Request $request
|
152 |
+
* @return Mage_Shipping_Model_Shipping
|
153 |
+
*/
|
154 |
+
public function collectCarrierRates($carrierCode, $request)
|
155 |
+
{
|
156 |
+
/* @var $carrier Mage_Shipping_Model_Carrier_Abstract */
|
157 |
+
$carrier = $this->getCarrierByCode($carrierCode, $request->getStoreId());
|
158 |
+
if (!$carrier) {
|
159 |
+
return $this;
|
160 |
+
}
|
161 |
+
$carrier->setActiveFlag($this->_availabilityConfigField);
|
162 |
+
$result = $carrier->checkAvailableShipCountries($request);
|
163 |
+
if (false !== $result && !($result instanceof Mage_Shipping_Model_Rate_Result_Error)) {
|
164 |
+
$result = $carrier->proccessAdditionalValidation($request);
|
165 |
+
}
|
166 |
+
/*
|
167 |
+
* Result will be false if the admin set not to show the shipping module
|
168 |
+
* if the delivery country is not within specific countries
|
169 |
+
*/
|
170 |
+
if (false !== $result){
|
171 |
+
if (!$result instanceof Mage_Shipping_Model_Rate_Result_Error) {
|
172 |
+
if ($carrier->getConfigData('shipment_requesttype')) {
|
173 |
+
$packages = $this->composePackagesForCarrier($carrier, $request);
|
174 |
+
if (!empty($packages)) {
|
175 |
+
$sumResults = array();
|
176 |
+
foreach ($packages as $weight => $packageCount) {
|
177 |
+
//clone carrier for multi-requests
|
178 |
+
$carrierObj = clone $carrier;
|
179 |
+
$request->setPackageWeight($weight);
|
180 |
+
$result = $carrierObj->collectRates($request);
|
181 |
+
if (!$result) {
|
182 |
+
return $this;
|
183 |
+
} else {
|
184 |
+
$result->updateRatePrice($packageCount);
|
185 |
+
}
|
186 |
+
$sumResults[] = $result;
|
187 |
+
}
|
188 |
+
if (!empty($sumResults) && count($sumResults) > 1) {
|
189 |
+
$result = array();
|
190 |
+
foreach ($sumResults as $res) {
|
191 |
+
if (empty($result)) {
|
192 |
+
$result = $res;
|
193 |
+
continue;
|
194 |
+
}
|
195 |
+
foreach ($res->getAllRates() as $method) {
|
196 |
+
foreach ($result->getAllRates() as $resultMethod) {
|
197 |
+
if ($method->getMethod() == $resultMethod->getMethod()) {
|
198 |
+
$resultMethod->setPrice($method->getPrice() + $resultMethod->getPrice());
|
199 |
+
continue;
|
200 |
+
}
|
201 |
+
}
|
202 |
+
}
|
203 |
+
}
|
204 |
+
}
|
205 |
+
} else {
|
206 |
+
$result = $carrier->collectRates($request);
|
207 |
+
}
|
208 |
+
} else {
|
209 |
+
$result = $carrier->collectRates($request);
|
210 |
+
}
|
211 |
+
if (!$result) {
|
212 |
+
return $this;
|
213 |
+
}
|
214 |
+
}
|
215 |
+
if ($carrier->getConfigData('showmethod') == 0 && $result->getError()) {
|
216 |
+
return $this;
|
217 |
+
}
|
218 |
+
// sort rates by price
|
219 |
+
if (method_exists($result, 'sortRatesByPrice')) {
|
220 |
+
$result->sortRatesByPrice();
|
221 |
+
}
|
222 |
+
$this->getResult()->append($result);
|
223 |
+
}
|
224 |
+
return $this;
|
225 |
+
}
|
226 |
+
|
227 |
+
/**
|
228 |
+
* Compose Packages For Carrier.
|
229 |
+
* Devides order into items and items into parts if it's neccesary
|
230 |
+
*
|
231 |
+
* @param Mage_Shipping_Model_Carrier_Abstract $carrier
|
232 |
+
* @param Mage_Shipping_Model_Rate_Request $request
|
233 |
+
* @return array [int, float]
|
234 |
+
*/
|
235 |
+
public function composePackagesForCarrier($carrier, $request)
|
236 |
+
{
|
237 |
+
$allItems = $request->getAllItems();
|
238 |
+
$fullItems = array();
|
239 |
+
|
240 |
+
$maxWeight = (float) $carrier->getConfigData('max_package_weight');
|
241 |
+
|
242 |
+
foreach ($allItems as $item) {
|
243 |
+
if ($item->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE
|
244 |
+
&& $item->getProduct()->getShipmentType()
|
245 |
+
) {
|
246 |
+
continue;
|
247 |
+
}
|
248 |
+
|
249 |
+
$qty = $item->getQty();
|
250 |
+
$changeQty = true;
|
251 |
+
$checkWeight = true;
|
252 |
+
$decimalItems = array();
|
253 |
+
|
254 |
+
if ($item->getParentItem()) {
|
255 |
+
if (!$item->getParentItem()->getProduct()->getShipmentType()) {
|
256 |
+
continue;
|
257 |
+
}
|
258 |
+
$qty = $item->getIsQtyDecimal()
|
259 |
+
? $item->getParentItem()->getQty()
|
260 |
+
: $item->getParentItem()->getQty() * $item->getQty();
|
261 |
+
}
|
262 |
+
|
263 |
+
$itemWeight = $item->getWeight();
|
264 |
+
if ($item->getIsQtyDecimal() && $item->getProductType() != Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
|
265 |
+
$stockItem = $item->getProduct()->getStockItem();
|
266 |
+
if ($stockItem->getIsDecimalDivided()) {
|
267 |
+
if ($stockItem->getEnableQtyIncrements() && $stockItem->getQtyIncrements()) {
|
268 |
+
$itemWeight = $itemWeight * $stockItem->getQtyIncrements();
|
269 |
+
$qty = round(($item->getWeight() / $itemWeight) * $qty);
|
270 |
+
$changeQty = false;
|
271 |
+
} else {
|
272 |
+
$itemWeight = $itemWeight * $item->getQty();
|
273 |
+
if ($itemWeight > $maxWeight) {
|
274 |
+
$qtyItem = floor($itemWeight / $maxWeight);
|
275 |
+
$decimalItems[] = array('weight' => $maxWeight, 'qty' => $qtyItem);
|
276 |
+
$weightItem = Mage::helper('core')->getExactDivision($itemWeight, $maxWeight);
|
277 |
+
if ($weightItem) {
|
278 |
+
$decimalItems[] = array('weight' => $weightItem, 'qty' => 1);
|
279 |
+
}
|
280 |
+
$checkWeight = false;
|
281 |
+
} else {
|
282 |
+
$itemWeight = $itemWeight * $item->getQty();
|
283 |
+
}
|
284 |
+
}
|
285 |
+
} else {
|
286 |
+
$itemWeight = $itemWeight * $item->getQty();
|
287 |
+
}
|
288 |
+
}
|
289 |
+
|
290 |
+
if ($checkWeight && $maxWeight && $itemWeight > $maxWeight) {
|
291 |
+
return array();
|
292 |
+
}
|
293 |
+
|
294 |
+
if ($changeQty && !$item->getParentItem() && $item->getIsQtyDecimal()
|
295 |
+
&& $item->getProductType() != Mage_Catalog_Model_Product_Type::TYPE_BUNDLE
|
296 |
+
) {
|
297 |
+
$qty = 1;
|
298 |
+
}
|
299 |
+
|
300 |
+
if (!empty($decimalItems)) {
|
301 |
+
foreach ($decimalItems as $decimalItem) {
|
302 |
+
$fullItems = array_merge($fullItems,
|
303 |
+
array_fill(0, $decimalItem['qty'] * $qty, $decimalItem['weight'])
|
304 |
+
);
|
305 |
+
}
|
306 |
+
} else {
|
307 |
+
$fullItems = array_merge($fullItems, array_fill(0, $qty, $itemWeight));
|
308 |
+
}
|
309 |
+
}
|
310 |
+
sort($fullItems);
|
311 |
+
|
312 |
+
return $this->_makePieces($fullItems, $maxWeight);
|
313 |
+
}
|
314 |
+
|
315 |
+
/**
|
316 |
+
* Make pieces
|
317 |
+
* Compose packeges list based on given items, so that each package is as heavy as possible
|
318 |
+
*
|
319 |
+
* @param array $items
|
320 |
+
* @param float $maxWeight
|
321 |
+
* @return array
|
322 |
+
*/
|
323 |
+
protected function _makePieces($items, $maxWeight)
|
324 |
+
{
|
325 |
+
$pieces = array();
|
326 |
+
if (!empty($items)) {
|
327 |
+
$sumWeight = 0;
|
328 |
+
|
329 |
+
$reverseOrderItems = $items;
|
330 |
+
arsort($reverseOrderItems);
|
331 |
+
|
332 |
+
foreach ($reverseOrderItems as $key => $weight) {
|
333 |
+
if (!isset($items[$key])) {
|
334 |
+
continue;
|
335 |
+
}
|
336 |
+
unset($items[$key]);
|
337 |
+
$sumWeight = $weight;
|
338 |
+
foreach ($items as $key => $weight) {
|
339 |
+
if (($sumWeight + $weight) < $maxWeight) {
|
340 |
+
unset($items[$key]);
|
341 |
+
$sumWeight += $weight;
|
342 |
+
} elseif (($sumWeight + $weight) > $maxWeight) {
|
343 |
+
$pieces[] = (string)(float)$sumWeight;
|
344 |
+
break;
|
345 |
+
} else {
|
346 |
+
unset($items[$key]);
|
347 |
+
$pieces[] = (string)(float)($sumWeight + $weight);
|
348 |
+
$sumWeight = 0;
|
349 |
+
break;
|
350 |
+
}
|
351 |
+
}
|
352 |
+
}
|
353 |
+
if ($sumWeight > 0) {
|
354 |
+
$pieces[] = (string)(float)$sumWeight;
|
355 |
+
}
|
356 |
+
$pieces = array_count_values($pieces);
|
357 |
+
}
|
358 |
+
|
359 |
+
return $pieces;
|
360 |
+
}
|
361 |
+
|
362 |
+
/**
|
363 |
+
* Collect rates by address
|
364 |
+
*
|
365 |
+
* @param Varien_Object $address
|
366 |
+
* @param null|bool|array $limitCarrier
|
367 |
+
* @return Mage_Shipping_Model_Shipping
|
368 |
+
*/
|
369 |
+
public function collectRatesByAddress(Varien_Object $address, $limitCarrier = null)
|
370 |
+
{
|
371 |
+
/** @var $request Mage_Shipping_Model_Rate_Request */
|
372 |
+
$request = Mage::getModel('shipping/rate_request');
|
373 |
+
$request->setAllItems($address->getAllItems());
|
374 |
+
$request->setDestCountryId($address->getCountryId());
|
375 |
+
$request->setDestRegionId($address->getRegionId());
|
376 |
+
$request->setDestPostcode($address->getPostcode());
|
377 |
+
$request->setPackageValue($address->getBaseSubtotal());
|
378 |
+
$request->setPackageValueWithDiscount($address->getBaseSubtotalWithDiscount());
|
379 |
+
$request->setPackageWeight($address->getWeight());
|
380 |
+
$request->setFreeMethodWeight($address->getFreeMethodWeight());
|
381 |
+
$request->setPackageQty($address->getItemQty());
|
382 |
+
$request->setStoreId(Mage::app()->getStore()->getId());
|
383 |
+
$request->setWebsiteId(Mage::app()->getStore()->getWebsiteId());
|
384 |
+
$request->setBaseCurrency(Mage::app()->getStore()->getBaseCurrency());
|
385 |
+
$request->setPackageCurrency(Mage::app()->getStore()->getCurrentCurrency());
|
386 |
+
$request->setLimitCarrier($limitCarrier);
|
387 |
+
|
388 |
+
$request->setBaseSubtotalInclTax($address->getBaseSubtotalInclTax()
|
389 |
+
+ $address->getBaseExtraTaxAmount());
|
390 |
+
|
391 |
+
return $this->collectRates($request);
|
392 |
+
}
|
393 |
+
|
394 |
+
/**
|
395 |
+
* Set part of carrier xml config path
|
396 |
+
*
|
397 |
+
* @param string $code
|
398 |
+
* @return Mage_Shipping_Model_Shipping
|
399 |
+
*/
|
400 |
+
public function setCarrierAvailabilityConfigField($code = 'active')
|
401 |
+
{
|
402 |
+
$this->_availabilityConfigField = $code;
|
403 |
+
return $this;
|
404 |
+
}
|
405 |
+
|
406 |
+
/**
|
407 |
+
* Get carrier by its code
|
408 |
+
*
|
409 |
+
* @param string $carrierCode
|
410 |
+
* @param null|int $storeId
|
411 |
+
* @return bool|Mage_Core_Model_Abstract
|
412 |
+
*/
|
413 |
+
public function getCarrierByCode($carrierCode, $storeId = null)
|
414 |
+
{
|
415 |
+
if (!Mage::getStoreConfigFlag('carriers/'.$carrierCode.'/'.$this->_availabilityConfigField, $storeId)) {
|
416 |
+
return false;
|
417 |
+
}
|
418 |
+
$className = Mage::getStoreConfig('carriers/'.$carrierCode.'/model', $storeId);
|
419 |
+
if (!$className) {
|
420 |
+
return false;
|
421 |
+
}
|
422 |
+
$obj = Mage::getModel($className);
|
423 |
+
if ($storeId) {
|
424 |
+
$obj->setStore($storeId);
|
425 |
+
}
|
426 |
+
return $obj;
|
427 |
+
}
|
428 |
+
|
429 |
+
/**
|
430 |
+
* Prepare and do request to shipment
|
431 |
+
*
|
432 |
+
* @param Mage_Sales_Model_Order_Shipment $orderShipment
|
433 |
+
* @return Varien_Object
|
434 |
+
*/
|
435 |
+
public function requestToShipment(Mage_Sales_Model_Order_Shipment $orderShipment)
|
436 |
+
{
|
437 |
+
$admin = Mage::getSingleton('admin/session')->getUser();
|
438 |
+
$order = $orderShipment->getOrder();
|
439 |
+
$address = $order->getShippingAddress();
|
440 |
+
$shippingMethod = $order->getShippingMethod(true);
|
441 |
+
$shipmentStoreId = $orderShipment->getStoreId();
|
442 |
+
$shipmentCarrier = $order->getShippingCarrier();
|
443 |
+
$baseCurrencyCode = Mage::app()->getStore($shipmentStoreId)->getBaseCurrencyCode();
|
444 |
+
if (!$shipmentCarrier) {
|
445 |
+
Mage::throwException('Invalid carrier: ' . $shippingMethod->getCarrierCode());
|
446 |
+
}
|
447 |
+
$shipperRegionCode = Mage::getStoreConfig(self::XML_PATH_STORE_REGION_ID, $shipmentStoreId);
|
448 |
+
if (is_numeric($shipperRegionCode)) {
|
449 |
+
$shipperRegionCode = Mage::getModel('directory/region')->load($shipperRegionCode)->getCode();
|
450 |
+
}
|
451 |
+
|
452 |
+
$recipientRegionCode = Mage::getModel('directory/region')->load($address->getRegionId())->getCode();
|
453 |
+
|
454 |
+
$originStreet1 = Mage::getStoreConfig(self::XML_PATH_STORE_ADDRESS1, $shipmentStoreId);
|
455 |
+
$originStreet2 = Mage::getStoreConfig(self::XML_PATH_STORE_ADDRESS2, $shipmentStoreId);
|
456 |
+
$storeInfo = new Varien_Object(Mage::getStoreConfig('general/store_information', $shipmentStoreId));
|
457 |
+
|
458 |
+
if (!$admin->getFirstname() || !$admin->getLastname() || !$storeInfo->getName() || !$storeInfo->getPhone()
|
459 |
+
|| !$originStreet1 || !Mage::getStoreConfig(self::XML_PATH_STORE_CITY, $shipmentStoreId)
|
460 |
+
|| !$shipperRegionCode || !Mage::getStoreConfig(self::XML_PATH_STORE_ZIP, $shipmentStoreId)
|
461 |
+
|| !Mage::getStoreConfig(self::XML_PATH_STORE_COUNTRY_ID, $shipmentStoreId)
|
462 |
+
) {
|
463 |
+
Mage::throwException(
|
464 |
+
Mage::helper('sales')->__('Insufficient information to create shipping label(s). Please verify your Store Information and Shipping Settings.')
|
465 |
+
);
|
466 |
+
}
|
467 |
+
|
468 |
+
/** @var $request Mage_Shipping_Model_Shipment_Request */
|
469 |
+
$request = Mage::getModel('shipping/shipment_request');
|
470 |
+
$request->setOrderShipment($orderShipment);
|
471 |
+
$request->setShipperContactPersonName($admin->getName());
|
472 |
+
$request->setShipperContactPersonFirstName($admin->getFirstname());
|
473 |
+
$request->setShipperContactPersonLastName($admin->getLastname());
|
474 |
+
$request->setShipperContactCompanyName($storeInfo->getName());
|
475 |
+
$request->setShipperContactPhoneNumber($storeInfo->getPhone());
|
476 |
+
$request->setShipperEmail($admin->getEmail());
|
477 |
+
$request->setShipperAddressStreet(trim($originStreet1 . ' ' . $originStreet2));
|
478 |
+
$request->setShipperAddressStreet1($originStreet1);
|
479 |
+
$request->setShipperAddressStreet2($originStreet2);
|
480 |
+
$request->setShipperAddressCity(Mage::getStoreConfig(self::XML_PATH_STORE_CITY, $shipmentStoreId));
|
481 |
+
$request->setShipperAddressStateOrProvinceCode($shipperRegionCode);
|
482 |
+
$request->setShipperAddressPostalCode(Mage::getStoreConfig(self::XML_PATH_STORE_ZIP, $shipmentStoreId));
|
483 |
+
$request->setShipperAddressCountryCode(Mage::getStoreConfig(self::XML_PATH_STORE_COUNTRY_ID, $shipmentStoreId));
|
484 |
+
$request->setRecipientContactPersonName(trim($address->getFirstname() . ' ' . $address->getLastname()));
|
485 |
+
$request->setRecipientContactPersonFirstName($address->getFirstname());
|
486 |
+
$request->setRecipientContactPersonLastName($address->getLastname());
|
487 |
+
$request->setRecipientContactCompanyName($address->getCompany());
|
488 |
+
$request->setRecipientContactPhoneNumber($address->getTelephone());
|
489 |
+
$request->setRecipientEmail($address->getEmail());
|
490 |
+
$request->setRecipientAddressStreet(trim($address->getStreet1() . ' ' . $address->getStreet2()));
|
491 |
+
$request->setRecipientAddressStreet1($address->getStreet1());
|
492 |
+
$request->setRecipientAddressStreet2($address->getStreet2());
|
493 |
+
$request->setRecipientAddressCity($address->getCity());
|
494 |
+
$request->setRecipientAddressStateOrProvinceCode($address->getRegionCode());
|
495 |
+
$request->setRecipientAddressRegionCode($recipientRegionCode);
|
496 |
+
$request->setRecipientAddressPostalCode($address->getPostcode());
|
497 |
+
$request->setRecipientAddressCountryCode($address->getCountryId());
|
498 |
+
$request->setShippingMethod($shippingMethod->getMethod());
|
499 |
+
$request->setPackageWeight($order->getWeight());
|
500 |
+
$request->setPackages($orderShipment->getPackages());
|
501 |
+
$request->setBaseCurrencyCode($baseCurrencyCode);
|
502 |
+
$request->setStoreId($shipmentStoreId);
|
503 |
+
|
504 |
+
return $shipmentCarrier->requestToShipment($request);
|
505 |
+
}
|
506 |
+
}
|
app/code/local/Mage/Shipping/Model/Source/HandlingAction.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
class Mage_Shipping_Model_Source_HandlingAction
|
27 |
+
{
|
28 |
+
public function toOptionArray()
|
29 |
+
{
|
30 |
+
return array(
|
31 |
+
array('value' => Mage_Shipping_Model_Carrier_Abstract::HANDLING_ACTION_PERORDER, 'label' => Mage::helper('shipping')->__('Per Order')),
|
32 |
+
array('value' => Mage_Shipping_Model_Carrier_Abstract::HANDLING_ACTION_PERPACKAGE , 'label' => Mage::helper('shipping')->__('Per Package')),
|
33 |
+
);
|
34 |
+
}
|
35 |
+
}
|
app/code/local/Mage/Shipping/Model/Source/HandlingType.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
class Mage_Shipping_Model_Source_HandlingType
|
27 |
+
{
|
28 |
+
public function toOptionArray()
|
29 |
+
{
|
30 |
+
return array(
|
31 |
+
array('value' => Mage_Shipping_Model_Carrier_Abstract::HANDLING_TYPE_FIXED, 'label' => Mage::helper('shipping')->__('Fixed')),
|
32 |
+
array('value' => Mage_Shipping_Model_Carrier_Abstract::HANDLING_TYPE_PERCENT, 'label' => Mage::helper('shipping')->__('Percent')),
|
33 |
+
);
|
34 |
+
}
|
35 |
+
}
|
app/code/local/Mage/Shipping/Model/Tracking/Result.php
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Mage_Shipping_Model_Tracking_Result
|
28 |
+
{
|
29 |
+
|
30 |
+
protected $_trackings = array();
|
31 |
+
protected $_error = null;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Reset tracking
|
35 |
+
*/
|
36 |
+
public function reset()
|
37 |
+
{
|
38 |
+
$this->_trackings = array();
|
39 |
+
return $this;
|
40 |
+
}
|
41 |
+
|
42 |
+
public function setError($error)
|
43 |
+
{
|
44 |
+
$this->_error = $error;
|
45 |
+
}
|
46 |
+
|
47 |
+
public function getError()
|
48 |
+
{
|
49 |
+
return $this->_error;
|
50 |
+
}
|
51 |
+
/**
|
52 |
+
* Add a tracking to the result
|
53 |
+
*/
|
54 |
+
public function append($result)
|
55 |
+
{
|
56 |
+
if ($result instanceof Mage_Shipping_Model_Tracking_Result_Abstract) {
|
57 |
+
$this->_trackings[] = $result;
|
58 |
+
} elseif ($result instanceof Mage_Shipping_Model_Rate_Result) {
|
59 |
+
$trackings = $result->getAllTrackings();
|
60 |
+
foreach ($trackings as $track) {
|
61 |
+
$this->append($track);
|
62 |
+
}
|
63 |
+
}
|
64 |
+
return $this;
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Return all trackings in the result
|
69 |
+
*/
|
70 |
+
public function getAllTrackings()
|
71 |
+
{
|
72 |
+
return $this->_trackings;
|
73 |
+
}
|
74 |
+
|
75 |
+
}
|
app/code/local/Mage/Shipping/Model/Tracking/Result/Abstract.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
class Mage_Shipping_Model_Tracking_Result_Abstract extends Varien_Object
|
29 |
+
{
|
30 |
+
|
31 |
+
}
|
app/code/local/Mage/Shipping/Model/Tracking/Result/Error.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
class Mage_Shipping_Model_Tracking_Result_Error extends Mage_Shipping_Model_Tracking_Result_Abstract
|
29 |
+
{
|
30 |
+
public function getAllData()
|
31 |
+
{
|
32 |
+
return $this->_data;
|
33 |
+
}
|
34 |
+
|
35 |
+
public function getErrorMessage()
|
36 |
+
{
|
37 |
+
return Mage::helper('shipping')->__('Tracking information is currently unavailable.');
|
38 |
+
}
|
39 |
+
}
|
app/code/local/Mage/Shipping/Model/Tracking/Result/Status.php
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Fields:
|
30 |
+
* - carrier: fedex
|
31 |
+
* - carrierTitle: Federal Express
|
32 |
+
* - tracking: 749011111111
|
33 |
+
* - status: delivered
|
34 |
+
* - service: home delivery
|
35 |
+
* - delivery date: 2007-11-23
|
36 |
+
* - delivery time: 16:01:00
|
37 |
+
* - delivery location: Frontdoor
|
38 |
+
* - signedby: lindy
|
39 |
+
*
|
40 |
+
* Fields:
|
41 |
+
* -carrier: ups cgi
|
42 |
+
* -popup: 1
|
43 |
+
* -url: http://wwwapps.ups.com/WebTracking/processInputRequest?HTMLVersion=5.0&error_carried=true&tracknums_displayed=5&TypeOfInquiryNumber=T&loc=en_US&InquiryNumber1=$tracking
|
44 |
+
*
|
45 |
+
* Fields:
|
46 |
+
* -carrier: usps
|
47 |
+
* -tracksummary: Your item was delivered at 6:50 am on February 6 in Los Angeles CA 90064
|
48 |
+
*/
|
49 |
+
class Mage_Shipping_Model_Tracking_Result_Status extends Mage_Shipping_Model_Tracking_Result_Abstract
|
50 |
+
{
|
51 |
+
public function getAllData(){
|
52 |
+
return $this->_data;
|
53 |
+
}
|
54 |
+
}
|
app/code/local/Mage/Shipping/controllers/ShippingController.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @deprecated after 1.3.2.3 - this controller is not used anywhere
|
29 |
+
*/
|
30 |
+
class Mage_Shipping_ShippingController extends Mage_Core_Controller_Front_Action
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* @deprecated after 1.3.2.3
|
34 |
+
*/
|
35 |
+
public function viewAction()
|
36 |
+
{
|
37 |
+
$params = $this->getRequest()->getPost();
|
38 |
+
$this->loadLayout();
|
39 |
+
$this->renderLayout();
|
40 |
+
}
|
41 |
+
}
|
app/code/local/Mage/Shipping/controllers/TrackingController.php
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Sales orders controller
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_Sales
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
|
35 |
+
class Mage_Shipping_TrackingController extends Mage_Core_Controller_Front_Action
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Ajax action
|
39 |
+
*
|
40 |
+
*/
|
41 |
+
public function ajaxAction()
|
42 |
+
{
|
43 |
+
if ($order = $this->_initOrder()) {
|
44 |
+
$response = '';
|
45 |
+
$tracks = $order->getTracksCollection();
|
46 |
+
|
47 |
+
$className = Mage::getConfig()->getBlockClassName('core/template');
|
48 |
+
$block = new $className();
|
49 |
+
$block->setType('core/template')
|
50 |
+
->setIsAnonymous(true)
|
51 |
+
->setTemplate('sales/order/trackinginfo.phtml');
|
52 |
+
|
53 |
+
foreach ($tracks as $track){
|
54 |
+
$trackingInfo = $track->getNumberDetail();
|
55 |
+
$block->setTrackingInfo($trackingInfo);
|
56 |
+
$response .= $block->toHtml()."\n<br />";
|
57 |
+
}
|
58 |
+
|
59 |
+
$this->getResponse()->setBody($response);
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Popup action
|
65 |
+
* Shows tracking info if it's present, otherwise redirects to 404
|
66 |
+
*/
|
67 |
+
public function popupAction()
|
68 |
+
{
|
69 |
+
$shippingInfoModel = Mage::getModel('shipping/info')->loadByHash($this->getRequest()->getParam('hash'));
|
70 |
+
Mage::register('current_shipping_info', $shippingInfoModel);
|
71 |
+
if (count($shippingInfoModel->getTrackingInfo()) == 0) {
|
72 |
+
$this->norouteAction();
|
73 |
+
return;
|
74 |
+
}
|
75 |
+
$this->loadLayout();
|
76 |
+
$this->renderLayout();
|
77 |
+
}
|
78 |
+
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Initialize order model instance
|
82 |
+
*
|
83 |
+
* @return Mage_Sales_Model_Order || false
|
84 |
+
*/
|
85 |
+
protected function _initOrder()
|
86 |
+
{
|
87 |
+
$id = $this->getRequest()->getParam('order_id');
|
88 |
+
|
89 |
+
$order = Mage::getModel('sales/order')->load($id);
|
90 |
+
$customerId = Mage::getSingleton('customer/session')->getCustomerId();
|
91 |
+
|
92 |
+
if (!$order->getId() || !$customerId || $order->getCustomerId() != $customerId) {
|
93 |
+
return false;
|
94 |
+
}
|
95 |
+
return $order;
|
96 |
+
}
|
97 |
+
|
98 |
+
}
|
app/code/local/Mage/Shipping/etc/adminhtml.xml
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/afl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Mage
|
23 |
+
* @package Mage_Shipping
|
24 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
25 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
26 |
+
*/
|
27 |
+
-->
|
28 |
+
<config>
|
29 |
+
<acl>
|
30 |
+
<resources>
|
31 |
+
<admin>
|
32 |
+
<children>
|
33 |
+
<system>
|
34 |
+
<children>
|
35 |
+
<config>
|
36 |
+
<children>
|
37 |
+
<shipping translate="title" module="shipping">
|
38 |
+
<title>Shipping Settings Section</title>
|
39 |
+
<sort_order>0</sort_order>
|
40 |
+
</shipping>
|
41 |
+
<carriers translate="title" module="shipping">
|
42 |
+
<title>Shipping Methods Section</title>
|
43 |
+
<sort_order>0</sort_order>
|
44 |
+
</carriers>
|
45 |
+
</children>
|
46 |
+
</config>
|
47 |
+
</children>
|
48 |
+
</system>
|
49 |
+
</children>
|
50 |
+
</admin>
|
51 |
+
</resources>
|
52 |
+
</acl>
|
53 |
+
</config>
|
app/code/local/Mage/Shipping/etc/config.xml
ADDED
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/afl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Mage
|
23 |
+
* @package Mage_Shipping
|
24 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
25 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
26 |
+
*/
|
27 |
+
-->
|
28 |
+
<config>
|
29 |
+
<modules>
|
30 |
+
<Mage_Shipping>
|
31 |
+
<version>1.6.0.0</version>
|
32 |
+
</Mage_Shipping>
|
33 |
+
</modules>
|
34 |
+
<global>
|
35 |
+
<models>
|
36 |
+
<shipping>
|
37 |
+
<class>Mage_Shipping_Model</class>
|
38 |
+
<resourceModel>shipping_resource</resourceModel>
|
39 |
+
</shipping>
|
40 |
+
<shipping_resource>
|
41 |
+
<class>Mage_Shipping_Model_Resource</class>
|
42 |
+
<deprecatedNode>shipping_mysql4</deprecatedNode>
|
43 |
+
<entities>
|
44 |
+
<tablerate>
|
45 |
+
<table>shipping_tablerate</table>
|
46 |
+
</tablerate>
|
47 |
+
</entities>
|
48 |
+
</shipping_resource>
|
49 |
+
</models>
|
50 |
+
<resources>
|
51 |
+
<shipping_setup>
|
52 |
+
<setup>
|
53 |
+
<module>Mage_Shipping</module>
|
54 |
+
</setup>
|
55 |
+
</shipping_setup>
|
56 |
+
</resources>
|
57 |
+
<sales>
|
58 |
+
<shipping>
|
59 |
+
<rule>
|
60 |
+
<conditions>
|
61 |
+
<dest_country>
|
62 |
+
<class>Mage_Sales_Model_Shipping_Rule_Condition_Dest_Country</class>
|
63 |
+
</dest_country>
|
64 |
+
<dest_region>
|
65 |
+
<class>Mage_Sales_Model_Shipping_Rule_Condition_Dest_Region</class>
|
66 |
+
</dest_region>
|
67 |
+
<dest_zip>
|
68 |
+
<class>Mage_Sales_Model_Shipping_Rule_Condition_Dest_Zip</class>
|
69 |
+
</dest_zip>
|
70 |
+
<package_weight>
|
71 |
+
<class>Mage_Sales_Model_Shipping_Rule_Condition_Package_Weight</class>
|
72 |
+
</package_weight>
|
73 |
+
<order_subtotal>
|
74 |
+
<class>Mage_Sales_Model_Shipping_Rule_Condition_Order_Subtotal</class>
|
75 |
+
</order_subtotal>
|
76 |
+
<order_totalqty>
|
77 |
+
<class>Mage_Sales_Model_Shipping_Rule_Condition_Order_Totalqty</class>
|
78 |
+
</order_totalqty>
|
79 |
+
</conditions>
|
80 |
+
<actions>
|
81 |
+
<carrier>
|
82 |
+
<class>Mage_Sales_Model_Shipping_Rule_Action_Carrier</class>
|
83 |
+
</carrier>
|
84 |
+
<method>
|
85 |
+
<class>Mage_Sales_Model_Shipping_Rule_Action_Method</class>
|
86 |
+
</method>
|
87 |
+
</actions>
|
88 |
+
</rule>
|
89 |
+
</shipping>
|
90 |
+
</sales>
|
91 |
+
</global>
|
92 |
+
<adminhtml>
|
93 |
+
<translate>
|
94 |
+
<modules>
|
95 |
+
<Mage_Shipping>
|
96 |
+
<files>
|
97 |
+
<default>Mage_Shipping.csv</default>
|
98 |
+
</files>
|
99 |
+
</Mage_Shipping>
|
100 |
+
</modules>
|
101 |
+
</translate>
|
102 |
+
</adminhtml>
|
103 |
+
<frontend>
|
104 |
+
<translate>
|
105 |
+
<modules>
|
106 |
+
<Mage_Shipping>
|
107 |
+
<files>
|
108 |
+
<default>Mage_Shipping.csv</default>
|
109 |
+
</files>
|
110 |
+
</Mage_Shipping>
|
111 |
+
</modules>
|
112 |
+
</translate>
|
113 |
+
<routers>
|
114 |
+
<shipping>
|
115 |
+
<use>standard</use>
|
116 |
+
<args>
|
117 |
+
<module>Mage_Shipping</module>
|
118 |
+
<frontName>shipping</frontName>
|
119 |
+
</args>
|
120 |
+
</shipping>
|
121 |
+
</routers>
|
122 |
+
<layout>
|
123 |
+
<updates>
|
124 |
+
<shipping>
|
125 |
+
<file>shipping.xml</file>
|
126 |
+
</shipping>
|
127 |
+
</updates>
|
128 |
+
</layout>
|
129 |
+
</frontend>
|
130 |
+
<default>
|
131 |
+
<shipping>
|
132 |
+
<option>
|
133 |
+
<checkout_multiple>1</checkout_multiple>
|
134 |
+
<checkout_multiple_maximum_qty>100</checkout_multiple_maximum_qty>
|
135 |
+
</option>
|
136 |
+
<origin>
|
137 |
+
<country_id>US</country_id>
|
138 |
+
<postcode>90034</postcode>
|
139 |
+
<region_id>12</region_id>
|
140 |
+
</origin>
|
141 |
+
</shipping>
|
142 |
+
<carriers>
|
143 |
+
<flatrate>
|
144 |
+
<active>1</active>
|
145 |
+
<sallowspecific>0</sallowspecific>
|
146 |
+
<model>shipping/carrier_flatrate</model>
|
147 |
+
<name>Fixed</name>
|
148 |
+
<price>5.00</price>
|
149 |
+
<title>Flat Rate</title>
|
150 |
+
<type>I</type>
|
151 |
+
<specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
|
152 |
+
<handling_type>F</handling_type>
|
153 |
+
</flatrate>
|
154 |
+
<freeshipping>
|
155 |
+
<active>0</active>
|
156 |
+
<sallowspecific>0</sallowspecific>
|
157 |
+
<cutoff_cost>50</cutoff_cost>
|
158 |
+
<model>shipping/carrier_freeshipping</model>
|
159 |
+
<name>Free</name>
|
160 |
+
<title>Free Shipping</title>
|
161 |
+
<specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
|
162 |
+
</freeshipping>
|
163 |
+
<tablerate>
|
164 |
+
<active>0</active>
|
165 |
+
<sallowspecific>0</sallowspecific>
|
166 |
+
<condition_name>package_weight</condition_name>
|
167 |
+
<include_virtual_price>1</include_virtual_price>
|
168 |
+
<model>shipping/carrier_tablerate</model>
|
169 |
+
<name>Table Rate</name>
|
170 |
+
<title>Best Way</title>
|
171 |
+
<specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
|
172 |
+
<handling_type>F</handling_type>
|
173 |
+
</tablerate>
|
174 |
+
</carriers>
|
175 |
+
</default>
|
176 |
+
</config>
|
app/code/local/Mage/Shipping/etc/system.xml
ADDED
@@ -0,0 +1,480 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/afl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Mage
|
23 |
+
* @package Mage_Shipping
|
24 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
25 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
26 |
+
*/
|
27 |
+
-->
|
28 |
+
<config>
|
29 |
+
<sections>
|
30 |
+
<shipping translate="label" module="shipping">
|
31 |
+
<label>Shipping Settings</label>
|
32 |
+
<tab>sales</tab>
|
33 |
+
<frontend_type>text</frontend_type>
|
34 |
+
<sort_order>310</sort_order>
|
35 |
+
<show_in_default>1</show_in_default>
|
36 |
+
<show_in_website>1</show_in_website>
|
37 |
+
<show_in_store>0</show_in_store>
|
38 |
+
<groups>
|
39 |
+
<option translate="label">
|
40 |
+
<label>Options</label>
|
41 |
+
<frontend_type>text</frontend_type>
|
42 |
+
<sort_order>2</sort_order>
|
43 |
+
<show_in_default>1</show_in_default>
|
44 |
+
<show_in_website>1</show_in_website>
|
45 |
+
<show_in_store>0</show_in_store>
|
46 |
+
<fields>
|
47 |
+
<checkout_multiple translate="label">
|
48 |
+
<label>Allow Shipping to Multiple Addresses</label>
|
49 |
+
<frontend_type>select</frontend_type>
|
50 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
51 |
+
<sort_order>1</sort_order>
|
52 |
+
<show_in_default>1</show_in_default>
|
53 |
+
<show_in_website>1</show_in_website>
|
54 |
+
<show_in_store>0</show_in_store>
|
55 |
+
</checkout_multiple>
|
56 |
+
<checkout_multiple_maximum_qty translate="label">
|
57 |
+
<label>Maximum Qty Allowed for Shipping to Multiple Addresses</label>
|
58 |
+
<frontend_type>text</frontend_type>
|
59 |
+
<validate>validate-number</validate>
|
60 |
+
<sort_order>2</sort_order>
|
61 |
+
<show_in_default>1</show_in_default>
|
62 |
+
<show_in_website>1</show_in_website>
|
63 |
+
<show_in_store>0</show_in_store>
|
64 |
+
</checkout_multiple_maximum_qty>
|
65 |
+
</fields>
|
66 |
+
</option>
|
67 |
+
<origin translate="label">
|
68 |
+
<label>Origin</label>
|
69 |
+
<frontend_type>text</frontend_type>
|
70 |
+
<sort_order>1</sort_order>
|
71 |
+
<show_in_default>1</show_in_default>
|
72 |
+
<show_in_website>1</show_in_website>
|
73 |
+
<show_in_store>0</show_in_store>
|
74 |
+
<fields>
|
75 |
+
<country_id translate="label">
|
76 |
+
<label>Country</label>
|
77 |
+
<frontend_type>select</frontend_type>
|
78 |
+
<frontend_class>countries</frontend_class>
|
79 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
80 |
+
<sort_order>10</sort_order>
|
81 |
+
<show_in_default>1</show_in_default>
|
82 |
+
<show_in_website>1</show_in_website>
|
83 |
+
<show_in_store>0</show_in_store>
|
84 |
+
</country_id>
|
85 |
+
<region_id translate="label">
|
86 |
+
<label>Region/State</label>
|
87 |
+
<frontend_type>text</frontend_type>
|
88 |
+
<sort_order>20</sort_order>
|
89 |
+
<show_in_default>1</show_in_default>
|
90 |
+
<show_in_website>1</show_in_website>
|
91 |
+
<show_in_store>0</show_in_store>
|
92 |
+
</region_id>
|
93 |
+
<postcode translate="label">
|
94 |
+
<label>ZIP/Postal Code</label>
|
95 |
+
<frontend_type>text</frontend_type>
|
96 |
+
<sort_order>30</sort_order>
|
97 |
+
<show_in_default>1</show_in_default>
|
98 |
+
<show_in_website>1</show_in_website>
|
99 |
+
<show_in_store>0</show_in_store>
|
100 |
+
</postcode>
|
101 |
+
<city translate="label">
|
102 |
+
<label>City</label>
|
103 |
+
<frontend_type>text</frontend_type>
|
104 |
+
<sort_order>40</sort_order>
|
105 |
+
<show_in_default>1</show_in_default>
|
106 |
+
<show_in_website>1</show_in_website>
|
107 |
+
<show_in_store>0</show_in_store>
|
108 |
+
</city>
|
109 |
+
<street_line1 translate="label">
|
110 |
+
<label>Street Address</label>
|
111 |
+
<frontend_type>text</frontend_type>
|
112 |
+
<sort_order>50</sort_order>
|
113 |
+
<show_in_default>1</show_in_default>
|
114 |
+
<show_in_website>1</show_in_website>
|
115 |
+
<show_in_store>0</show_in_store>
|
116 |
+
</street_line1>
|
117 |
+
<street_line2 translate="label">
|
118 |
+
<label>Street Address Line 2</label>
|
119 |
+
<frontend_type>text</frontend_type>
|
120 |
+
<sort_order>60</sort_order>
|
121 |
+
<show_in_default>1</show_in_default>
|
122 |
+
<show_in_website>1</show_in_website>
|
123 |
+
<show_in_store>0</show_in_store>
|
124 |
+
</street_line2>
|
125 |
+
</fields>
|
126 |
+
</origin>
|
127 |
+
</groups>
|
128 |
+
</shipping>
|
129 |
+
<carriers translate="label" module="shipping">
|
130 |
+
<label>Shipping Methods</label>
|
131 |
+
<tab>sales</tab>
|
132 |
+
<frontend_type>text</frontend_type>
|
133 |
+
<sort_order>320</sort_order>
|
134 |
+
<show_in_default>1</show_in_default>
|
135 |
+
<show_in_website>1</show_in_website>
|
136 |
+
<show_in_store>1</show_in_store>
|
137 |
+
<groups>
|
138 |
+
<flatrate translate="label">
|
139 |
+
<label>Flat Rate</label>
|
140 |
+
<frontend_type>text</frontend_type>
|
141 |
+
<sort_order>2</sort_order>
|
142 |
+
<show_in_default>1</show_in_default>
|
143 |
+
<show_in_website>1</show_in_website>
|
144 |
+
<show_in_store>1</show_in_store>
|
145 |
+
<fields>
|
146 |
+
<active translate="label">
|
147 |
+
<label>Enabled</label>
|
148 |
+
<frontend_type>select</frontend_type>
|
149 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
150 |
+
<sort_order>1</sort_order>
|
151 |
+
<show_in_default>1</show_in_default>
|
152 |
+
<show_in_website>1</show_in_website>
|
153 |
+
<show_in_store>0</show_in_store>
|
154 |
+
</active>
|
155 |
+
<name translate="label">
|
156 |
+
<label>Method Name</label>
|
157 |
+
<frontend_type>text</frontend_type>
|
158 |
+
<sort_order>3</sort_order>
|
159 |
+
<show_in_default>1</show_in_default>
|
160 |
+
<show_in_website>1</show_in_website>
|
161 |
+
<show_in_store>1</show_in_store>
|
162 |
+
</name>
|
163 |
+
<price translate="label">
|
164 |
+
<label>Price</label>
|
165 |
+
<frontend_type>text</frontend_type>
|
166 |
+
<validate>validate-number validate-zero-or-greater</validate>
|
167 |
+
<sort_order>5</sort_order>
|
168 |
+
<show_in_default>1</show_in_default>
|
169 |
+
<show_in_website>1</show_in_website>
|
170 |
+
<show_in_store>0</show_in_store>
|
171 |
+
</price>
|
172 |
+
<handling_type translate="label">
|
173 |
+
<label>Calculate Handling Fee</label>
|
174 |
+
<frontend_type>select</frontend_type>
|
175 |
+
<source_model>shipping/source_handlingType</source_model>
|
176 |
+
<sort_order>7</sort_order>
|
177 |
+
<show_in_default>1</show_in_default>
|
178 |
+
<show_in_website>1</show_in_website>
|
179 |
+
<show_in_store>0</show_in_store>
|
180 |
+
</handling_type>
|
181 |
+
<handling_fee translate="label">
|
182 |
+
<label>Handling Fee</label>
|
183 |
+
<frontend_type>text</frontend_type>
|
184 |
+
<validate>validate-number validate-zero-or-greater</validate>
|
185 |
+
<sort_order>8</sort_order>
|
186 |
+
<show_in_default>1</show_in_default>
|
187 |
+
<show_in_website>1</show_in_website>
|
188 |
+
<show_in_store>0</show_in_store>
|
189 |
+
</handling_fee>
|
190 |
+
<sort_order translate="label">
|
191 |
+
<label>Sort Order</label>
|
192 |
+
<frontend_type>text</frontend_type>
|
193 |
+
<sort_order>100</sort_order>
|
194 |
+
<show_in_default>1</show_in_default>
|
195 |
+
<show_in_website>1</show_in_website>
|
196 |
+
<show_in_store>0</show_in_store>
|
197 |
+
</sort_order>
|
198 |
+
<title translate="label">
|
199 |
+
<label>Title</label>
|
200 |
+
<frontend_type>text</frontend_type>
|
201 |
+
<sort_order>2</sort_order>
|
202 |
+
<show_in_default>1</show_in_default>
|
203 |
+
<show_in_website>1</show_in_website>
|
204 |
+
<show_in_store>1</show_in_store>
|
205 |
+
</title>
|
206 |
+
<type translate="label">
|
207 |
+
<label>Type</label>
|
208 |
+
<frontend_type>select</frontend_type>
|
209 |
+
<source_model>adminhtml/system_config_source_shipping_flatrate</source_model>
|
210 |
+
<sort_order>4</sort_order>
|
211 |
+
<show_in_default>1</show_in_default>
|
212 |
+
<show_in_website>1</show_in_website>
|
213 |
+
<show_in_store>0</show_in_store>
|
214 |
+
</type>
|
215 |
+
<sallowspecific translate="label">
|
216 |
+
<label>Ship to Applicable Countries</label>
|
217 |
+
<frontend_type>select</frontend_type>
|
218 |
+
<sort_order>90</sort_order>
|
219 |
+
<frontend_class>shipping-applicable-country</frontend_class>
|
220 |
+
<source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
|
221 |
+
<show_in_default>1</show_in_default>
|
222 |
+
<show_in_website>1</show_in_website>
|
223 |
+
<show_in_store>0</show_in_store>
|
224 |
+
</sallowspecific>
|
225 |
+
<specificcountry translate="label">
|
226 |
+
<label>Ship to Specific Countries</label>
|
227 |
+
<frontend_type>multiselect</frontend_type>
|
228 |
+
<sort_order>91</sort_order>
|
229 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
230 |
+
<show_in_default>1</show_in_default>
|
231 |
+
<show_in_website>1</show_in_website>
|
232 |
+
<show_in_store>0</show_in_store>
|
233 |
+
<can_be_empty>1</can_be_empty>
|
234 |
+
</specificcountry>
|
235 |
+
<showmethod translate="label">
|
236 |
+
<label>Show Method if Not Applicable</label>
|
237 |
+
<frontend_type>select</frontend_type>
|
238 |
+
<sort_order>92</sort_order>
|
239 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
240 |
+
<show_in_default>1</show_in_default>
|
241 |
+
<show_in_website>1</show_in_website>
|
242 |
+
<show_in_store>0</show_in_store>
|
243 |
+
</showmethod>
|
244 |
+
<specificerrmsg translate="label">
|
245 |
+
<label>Displayed Error Message</label>
|
246 |
+
<frontend_type>textarea</frontend_type>
|
247 |
+
<sort_order>80</sort_order>
|
248 |
+
<show_in_default>1</show_in_default>
|
249 |
+
<show_in_website>1</show_in_website>
|
250 |
+
<show_in_store>1</show_in_store>
|
251 |
+
</specificerrmsg>
|
252 |
+
</fields>
|
253 |
+
</flatrate>
|
254 |
+
<freeshipping translate="label">
|
255 |
+
<label>Free Shipping</label>
|
256 |
+
<frontend_type>text</frontend_type>
|
257 |
+
<sort_order>2</sort_order>
|
258 |
+
<show_in_default>1</show_in_default>
|
259 |
+
<show_in_website>1</show_in_website>
|
260 |
+
<show_in_store>1</show_in_store>
|
261 |
+
<fields>
|
262 |
+
<active translate="label">
|
263 |
+
<label>Enabled</label>
|
264 |
+
<frontend_type>select</frontend_type>
|
265 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
266 |
+
<sort_order>1</sort_order>
|
267 |
+
<show_in_default>1</show_in_default>
|
268 |
+
<show_in_website>1</show_in_website>
|
269 |
+
<show_in_store>0</show_in_store>
|
270 |
+
</active>
|
271 |
+
<free_shipping_subtotal translate="label">
|
272 |
+
<label>Minimum Order Amount</label>
|
273 |
+
<frontend_type>text</frontend_type>
|
274 |
+
<validate>validate-number validate-zero-or-greater</validate>
|
275 |
+
<sort_order>4</sort_order>
|
276 |
+
<show_in_default>1</show_in_default>
|
277 |
+
<show_in_website>1</show_in_website>
|
278 |
+
<show_in_store>0</show_in_store>
|
279 |
+
</free_shipping_subtotal>
|
280 |
+
<name translate="label">
|
281 |
+
<label>Method Name</label>
|
282 |
+
<frontend_type>text</frontend_type>
|
283 |
+
<sort_order>3</sort_order>
|
284 |
+
<show_in_default>1</show_in_default>
|
285 |
+
<show_in_website>1</show_in_website>
|
286 |
+
<show_in_store>1</show_in_store>
|
287 |
+
</name>
|
288 |
+
<sort_order translate="label">
|
289 |
+
<label>Sort Order</label>
|
290 |
+
<frontend_type>text</frontend_type>
|
291 |
+
<sort_order>100</sort_order>
|
292 |
+
<show_in_default>1</show_in_default>
|
293 |
+
<show_in_website>1</show_in_website>
|
294 |
+
<show_in_store>0</show_in_store>
|
295 |
+
</sort_order>
|
296 |
+
<title translate="label">
|
297 |
+
<label>Title</label>
|
298 |
+
<frontend_type>text</frontend_type>
|
299 |
+
<sort_order>2</sort_order>
|
300 |
+
<show_in_default>1</show_in_default>
|
301 |
+
<show_in_website>1</show_in_website>
|
302 |
+
<show_in_store>1</show_in_store>
|
303 |
+
</title>
|
304 |
+
<sallowspecific translate="label">
|
305 |
+
<label>Ship to Applicable Countries</label>
|
306 |
+
<frontend_type>select</frontend_type>
|
307 |
+
<sort_order>90</sort_order>
|
308 |
+
<frontend_class>shipping-applicable-country</frontend_class>
|
309 |
+
<source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
|
310 |
+
<show_in_default>1</show_in_default>
|
311 |
+
<show_in_website>1</show_in_website>
|
312 |
+
<show_in_store>0</show_in_store>
|
313 |
+
</sallowspecific>
|
314 |
+
<specificcountry translate="label">
|
315 |
+
<label>Ship to Specific Countries</label>
|
316 |
+
<frontend_type>multiselect</frontend_type>
|
317 |
+
<sort_order>91</sort_order>
|
318 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
319 |
+
<show_in_default>1</show_in_default>
|
320 |
+
<show_in_website>1</show_in_website>
|
321 |
+
<show_in_store>0</show_in_store>
|
322 |
+
<can_be_empty>1</can_be_empty>
|
323 |
+
</specificcountry>
|
324 |
+
<showmethod translate="label">
|
325 |
+
<label>Show Method if Not Applicable</label>
|
326 |
+
<frontend_type>select</frontend_type>
|
327 |
+
<sort_order>92</sort_order>
|
328 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
329 |
+
<show_in_default>1</show_in_default>
|
330 |
+
<show_in_website>1</show_in_website>
|
331 |
+
<show_in_store>0</show_in_store>
|
332 |
+
</showmethod>
|
333 |
+
<specificerrmsg translate="label">
|
334 |
+
<label>Displayed Error Message</label>
|
335 |
+
<frontend_type>textarea</frontend_type>
|
336 |
+
<sort_order>80</sort_order>
|
337 |
+
<show_in_default>1</show_in_default>
|
338 |
+
<show_in_website>1</show_in_website>
|
339 |
+
<show_in_store>1</show_in_store>
|
340 |
+
</specificerrmsg>
|
341 |
+
</fields>
|
342 |
+
</freeshipping>
|
343 |
+
<tablerate translate="label">
|
344 |
+
<label>Table Rates</label>
|
345 |
+
<frontend_type>text</frontend_type>
|
346 |
+
<sort_order>2</sort_order>
|
347 |
+
<show_in_default>1</show_in_default>
|
348 |
+
<show_in_website>1</show_in_website>
|
349 |
+
<show_in_store>1</show_in_store>
|
350 |
+
<fields>
|
351 |
+
<handling_type translate="label">
|
352 |
+
<label>Calculate Handling Fee</label>
|
353 |
+
<frontend_type>select</frontend_type>
|
354 |
+
<source_model>shipping/source_handlingType</source_model>
|
355 |
+
<sort_order>7</sort_order>
|
356 |
+
<show_in_default>1</show_in_default>
|
357 |
+
<show_in_website>1</show_in_website>
|
358 |
+
<show_in_store>0</show_in_store>
|
359 |
+
</handling_type>
|
360 |
+
<handling_fee translate="label">
|
361 |
+
<label>Handling Fee</label>
|
362 |
+
<frontend_type>text</frontend_type>
|
363 |
+
<validate>validate-number validate-zero-or-greater</validate>
|
364 |
+
<sort_order>8</sort_order>
|
365 |
+
<show_in_default>1</show_in_default>
|
366 |
+
<show_in_website>1</show_in_website>
|
367 |
+
<show_in_store>0</show_in_store>
|
368 |
+
</handling_fee>
|
369 |
+
<active translate="label">
|
370 |
+
<label>Enabled</label>
|
371 |
+
<frontend_type>select</frontend_type>
|
372 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
373 |
+
<sort_order>1</sort_order>
|
374 |
+
<show_in_default>1</show_in_default>
|
375 |
+
<show_in_website>1</show_in_website>
|
376 |
+
<show_in_store>0</show_in_store>
|
377 |
+
</active>
|
378 |
+
<condition_name translate="label">
|
379 |
+
<label>Condition</label>
|
380 |
+
<frontend_type>select</frontend_type>
|
381 |
+
<source_model>adminhtml/system_config_source_shipping_tablerate</source_model>
|
382 |
+
<sort_order>4</sort_order>
|
383 |
+
<show_in_default>1</show_in_default>
|
384 |
+
<show_in_website>1</show_in_website>
|
385 |
+
<show_in_store>0</show_in_store>
|
386 |
+
</condition_name>
|
387 |
+
<include_virtual_price translate="label">
|
388 |
+
<label>Include Virtual Products in Price Calculation</label>
|
389 |
+
<frontend_type>select</frontend_type>
|
390 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
391 |
+
<sort_order>5</sort_order>
|
392 |
+
<show_in_default>1</show_in_default>
|
393 |
+
<show_in_website>1</show_in_website>
|
394 |
+
<show_in_store>0</show_in_store>
|
395 |
+
</include_virtual_price>
|
396 |
+
<export translate="label">
|
397 |
+
<label>Export</label>
|
398 |
+
<frontend_type>export</frontend_type>
|
399 |
+
<sort_order>5</sort_order>
|
400 |
+
<show_in_default>0</show_in_default>
|
401 |
+
<show_in_website>1</show_in_website>
|
402 |
+
<show_in_store>0</show_in_store>
|
403 |
+
</export>
|
404 |
+
<import translate="label">
|
405 |
+
<label>Import</label>
|
406 |
+
<frontend_type>import</frontend_type>
|
407 |
+
<backend_model>adminhtml/system_config_backend_shipping_tablerate</backend_model>
|
408 |
+
<sort_order>6</sort_order>
|
409 |
+
<show_in_default>0</show_in_default>
|
410 |
+
<show_in_website>1</show_in_website>
|
411 |
+
<show_in_store>0</show_in_store>
|
412 |
+
</import>
|
413 |
+
<name translate="label">
|
414 |
+
<label>Method Name</label>
|
415 |
+
<frontend_type>text</frontend_type>
|
416 |
+
<sort_order>3</sort_order>
|
417 |
+
<show_in_default>1</show_in_default>
|
418 |
+
<show_in_website>1</show_in_website>
|
419 |
+
<show_in_store>1</show_in_store>
|
420 |
+
</name>
|
421 |
+
<sort_order translate="label">
|
422 |
+
<label>Sort Order</label>
|
423 |
+
<frontend_type>text</frontend_type>
|
424 |
+
<sort_order>100</sort_order>
|
425 |
+
<show_in_default>1</show_in_default>
|
426 |
+
<show_in_website>1</show_in_website>
|
427 |
+
<show_in_store>0</show_in_store>
|
428 |
+
</sort_order>
|
429 |
+
<title translate="label">
|
430 |
+
<label>Title</label>
|
431 |
+
<frontend_type>text</frontend_type>
|
432 |
+
<sort_order>2</sort_order>
|
433 |
+
<show_in_default>1</show_in_default>
|
434 |
+
<show_in_website>1</show_in_website>
|
435 |
+
<show_in_store>1</show_in_store>
|
436 |
+
</title>
|
437 |
+
<sallowspecific translate="label">
|
438 |
+
<label>Ship to Applicable Countries</label>
|
439 |
+
<frontend_type>select</frontend_type>
|
440 |
+
<sort_order>90</sort_order>
|
441 |
+
<frontend_class>shipping-applicable-country</frontend_class>
|
442 |
+
<source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
|
443 |
+
<show_in_default>1</show_in_default>
|
444 |
+
<show_in_website>1</show_in_website>
|
445 |
+
<show_in_store>0</show_in_store>
|
446 |
+
</sallowspecific>
|
447 |
+
<specificcountry translate="label">
|
448 |
+
<label>Ship to Specific Countries</label>
|
449 |
+
<frontend_type>multiselect</frontend_type>
|
450 |
+
<sort_order>91</sort_order>
|
451 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
452 |
+
<show_in_default>1</show_in_default>
|
453 |
+
<show_in_website>1</show_in_website>
|
454 |
+
<show_in_store>0</show_in_store>
|
455 |
+
<can_be_empty>1</can_be_empty>
|
456 |
+
</specificcountry>
|
457 |
+
<showmethod translate="label">
|
458 |
+
<label>Show Method if Not Applicable</label>
|
459 |
+
<frontend_type>select</frontend_type>
|
460 |
+
<sort_order>92</sort_order>
|
461 |
+
<frontend_class>shipping-skip-hide</frontend_class>
|
462 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
463 |
+
<show_in_default>1</show_in_default>
|
464 |
+
<show_in_website>1</show_in_website>
|
465 |
+
<show_in_store>0</show_in_store>
|
466 |
+
</showmethod>
|
467 |
+
<specificerrmsg translate="label">
|
468 |
+
<label>Displayed Error Message</label>
|
469 |
+
<frontend_type>textarea</frontend_type>
|
470 |
+
<sort_order>80</sort_order>
|
471 |
+
<show_in_default>1</show_in_default>
|
472 |
+
<show_in_website>1</show_in_website>
|
473 |
+
<show_in_store>1</show_in_store>
|
474 |
+
</specificerrmsg>
|
475 |
+
</fields>
|
476 |
+
</tablerate>
|
477 |
+
</groups>
|
478 |
+
</carriers>
|
479 |
+
</sections>
|
480 |
+
</config>
|
app/code/local/Mage/Shipping/sql/shipping_setup/install-1.6.0.0.php
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
$installer = $this;
|
28 |
+
/** @var $installer Mage_Core_Model_Resource_Setup */
|
29 |
+
|
30 |
+
$installer->startSetup();
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Create table 'shipping/tablerate'
|
34 |
+
*/
|
35 |
+
$table = $installer->getConnection()
|
36 |
+
->newTable($installer->getTable('shipping/tablerate'))
|
37 |
+
->addColumn('pk', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
38 |
+
'identity' => true,
|
39 |
+
'unsigned' => true,
|
40 |
+
'nullable' => false,
|
41 |
+
'primary' => true,
|
42 |
+
), 'Primary key')
|
43 |
+
->addColumn('website_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
44 |
+
'nullable' => false,
|
45 |
+
'default' => '0',
|
46 |
+
), 'Website Id')
|
47 |
+
->addColumn('dest_country_id', Varien_Db_Ddl_Table::TYPE_TEXT, 4, array(
|
48 |
+
'nullable' => false,
|
49 |
+
'default' => '0',
|
50 |
+
), 'Destination coutry ISO/2 or ISO/3 code')
|
51 |
+
->addColumn('dest_region_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
52 |
+
'nullable' => false,
|
53 |
+
'default' => '0',
|
54 |
+
), 'Destination Region Id')
|
55 |
+
->addColumn('dest_zip', Varien_Db_Ddl_Table::TYPE_TEXT, 10, array(
|
56 |
+
'nullable' => false,
|
57 |
+
'default' => '*',
|
58 |
+
), 'Destination Post Code (Zip)')
|
59 |
+
->addColumn('condition_name', Varien_Db_Ddl_Table::TYPE_TEXT, 20, array(
|
60 |
+
'nullable' => false,
|
61 |
+
), 'Rate Condition name')
|
62 |
+
->addColumn('condition_value', Varien_Db_Ddl_Table::TYPE_DECIMAL, '12,4', array(
|
63 |
+
'nullable' => false,
|
64 |
+
'default' => '0.0000',
|
65 |
+
), 'Rate condition value')
|
66 |
+
->addColumn('price', Varien_Db_Ddl_Table::TYPE_DECIMAL, '12,4', array(
|
67 |
+
'nullable' => false,
|
68 |
+
'default' => '0.0000',
|
69 |
+
), 'Price')
|
70 |
+
->addColumn('cost', Varien_Db_Ddl_Table::TYPE_DECIMAL, '12,4', array(
|
71 |
+
'nullable' => false,
|
72 |
+
'default' => '0.0000',
|
73 |
+
), 'Cost')
|
74 |
+
->addIndex($installer->getIdxName('shipping/tablerate', array('website_id', 'dest_country_id', 'dest_region_id', 'dest_zip', 'condition_name', 'condition_value'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE),
|
75 |
+
array('website_id', 'dest_country_id', 'dest_region_id', 'dest_zip', 'condition_name', 'condition_value'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE))
|
76 |
+
->setComment('Shipping Tablerate');
|
77 |
+
$installer->getConnection()->createTable($table);
|
78 |
+
|
79 |
+
$installer->endSetup();
|
app/code/local/Mage/Shipping/sql/shipping_setup/mysql4-install-0.7.0.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
$installer = $this;
|
28 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
29 |
+
|
30 |
+
$installer->startSetup();
|
31 |
+
|
32 |
+
$installer->run("
|
33 |
+
|
34 |
+
-- DROP TABLE IF EXISTS {$this->getTable('shipping_tablerate')};
|
35 |
+
CREATE TABLE {$this->getTable('shipping_tablerate')} (
|
36 |
+
`pk` int(10) unsigned NOT NULL auto_increment,
|
37 |
+
`website_id` int(11) NOT NULL default '0',
|
38 |
+
`dest_country_id` varchar(4) NOT NULL default '0',
|
39 |
+
`dest_region_id` int(10) NOT NULL default '0',
|
40 |
+
`dest_zip` varchar(10) NOT NULL default '',
|
41 |
+
`condition_name` varchar(20) NOT NULL default '',
|
42 |
+
`condition_value` decimal(12,4) NOT NULL default '0.0000',
|
43 |
+
`price` decimal(12,4) NOT NULL default '0.0000',
|
44 |
+
`cost` decimal(12,4) NOT NULL default '0.0000',
|
45 |
+
PRIMARY KEY (`pk`),
|
46 |
+
UNIQUE KEY `dest_country` (`website_id`,`dest_country_id`,`dest_region_id`,`dest_zip`,`condition_name`,`condition_value`)
|
47 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
48 |
+
|
49 |
+
");
|
50 |
+
|
51 |
+
$installer->endSetup();
|
app/code/local/Mage/Shipping/sql/shipping_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php
ADDED
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Shipping
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
28 |
+
$installer = $this;
|
29 |
+
$installer->startSetup();
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Drop indexes
|
33 |
+
*/
|
34 |
+
$installer->getConnection()->dropIndex(
|
35 |
+
$installer->getTable('shipping/tablerate'),
|
36 |
+
'DEST_COUNTRY'
|
37 |
+
);
|
38 |
+
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Change columns
|
42 |
+
*/
|
43 |
+
$tables = array(
|
44 |
+
$installer->getTable('shipping/tablerate') => array(
|
45 |
+
'columns' => array(
|
46 |
+
'pk' => array(
|
47 |
+
'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
|
48 |
+
'identity' => true,
|
49 |
+
'unsigned' => true,
|
50 |
+
'nullable' => false,
|
51 |
+
'primary' => true,
|
52 |
+
'comment' => 'Primary key'
|
53 |
+
),
|
54 |
+
'website_id' => array(
|
55 |
+
'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
|
56 |
+
'nullable' => false,
|
57 |
+
'default' => '0',
|
58 |
+
'comment' => 'Website Id'
|
59 |
+
),
|
60 |
+
'dest_country_id' => array(
|
61 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
62 |
+
'length' => 4,
|
63 |
+
'nullable' => false,
|
64 |
+
'default' => '0',
|
65 |
+
'comment' => 'Destination coutry ISO/2 or ISO/3 code'
|
66 |
+
),
|
67 |
+
'dest_region_id' => array(
|
68 |
+
'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
|
69 |
+
'nullable' => false,
|
70 |
+
'default' => '0',
|
71 |
+
'comment' => 'Destination Region Id'
|
72 |
+
),
|
73 |
+
'dest_zip' => array(
|
74 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
75 |
+
'length' => 10,
|
76 |
+
'nullable' => false,
|
77 |
+
'default' => '*',
|
78 |
+
'comment' => 'Destination Post Code (Zip)'
|
79 |
+
),
|
80 |
+
'condition_name' => array(
|
81 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
82 |
+
'length' => 20,
|
83 |
+
'nullable' => false,
|
84 |
+
'comment' => 'Rate Condition name'
|
85 |
+
),
|
86 |
+
'condition_value' => array(
|
87 |
+
'type' => Varien_Db_Ddl_Table::TYPE_DECIMAL,
|
88 |
+
'scale' => 4,
|
89 |
+
'precision' => 12,
|
90 |
+
'nullable' => false,
|
91 |
+
'default' => '0.0000',
|
92 |
+
'comment' => 'Rate condition value'
|
93 |
+
),
|
94 |
+
'price' => array(
|
95 |
+
'type' => Varien_Db_Ddl_Table::TYPE_DECIMAL,
|
96 |
+
'scale' => 4,
|
97 |
+
'precision' => 12,
|
98 |
+
'nullable' => false,
|
99 |
+
'default' => '0.0000',
|
100 |
+
'comment' => 'Price'
|
101 |
+
),
|
102 |
+
'cost' => array(
|
103 |
+
'type' => Varien_Db_Ddl_Table::TYPE_DECIMAL,
|
104 |
+
'scale' => 4,
|
105 |
+
'precision' => 12,
|
106 |
+
'nullable' => false,
|
107 |
+
'default' => '0.0000',
|
108 |
+
'comment' => 'Cost'
|
109 |
+
)
|
110 |
+
),
|
111 |
+
'comment' => 'Shipping Tablerate'
|
112 |
+
)
|
113 |
+
);
|
114 |
+
|
115 |
+
$installer->getConnection()->modifyTables($tables);
|
116 |
+
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Add indexes
|
120 |
+
*/
|
121 |
+
$installer->getConnection()->addIndex(
|
122 |
+
$installer->getTable('shipping/tablerate'),
|
123 |
+
$installer->getIdxName(
|
124 |
+
'shipping/tablerate',
|
125 |
+
array('website_id', 'dest_country_id', 'dest_region_id', 'dest_zip', 'condition_name', 'condition_value'),
|
126 |
+
Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
|
127 |
+
),
|
128 |
+
array('website_id', 'dest_country_id', 'dest_region_id', 'dest_zip', 'condition_name', 'condition_value'),
|
129 |
+
Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
|
130 |
+
);
|
131 |
+
|
132 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/fee.xml
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<adminhtml_sales_order_view>
|
4 |
+
<reference name="order_totals">
|
5 |
+
<block type="adminhtml/sales_order_totals_item" name="fee" template="fee/sales/order/total.phtml">
|
6 |
+
</block>
|
7 |
+
<block type="adminhtml/sales_order_totals_item" name="fee.refunded" template="fee/sales/order/refunded.phtml">
|
8 |
+
<action method="setDisplayArea"><area>footer</area></action>
|
9 |
+
<action method="setAfterCondition"><condition>last</condition></action>
|
10 |
+
</block>
|
11 |
+
</reference>
|
12 |
+
</adminhtml_sales_order_view>
|
13 |
+
|
14 |
+
<adminhtml_sales_order_invoice_new>
|
15 |
+
<reference name="invoice_totals">
|
16 |
+
<block type="adminhtml/sales_order_totals_item" name="fee" template="fee/sales/order/total.phtml">
|
17 |
+
</block>
|
18 |
+
</reference>
|
19 |
+
</adminhtml_sales_order_invoice_new>
|
20 |
+
|
21 |
+
<adminhtml_sales_order_invoice_updateqty>
|
22 |
+
<reference name="invoice_totals">
|
23 |
+
<block type="adminhtml/sales_order_totals_item" name="fee" template="fee/sales/order/total.phtml">
|
24 |
+
</block>
|
25 |
+
</reference>
|
26 |
+
</adminhtml_sales_order_invoice_updateqty>
|
27 |
+
|
28 |
+
<adminhtml_sales_order_invoice_view>
|
29 |
+
<reference name="invoice_totals">
|
30 |
+
<block type="adminhtml/sales_order_totals_item" name="fee" template="fee/sales/order/total.phtml">
|
31 |
+
</block>
|
32 |
+
</reference>
|
33 |
+
</adminhtml_sales_order_invoice_view>
|
34 |
+
|
35 |
+
<adminhtml_sales_order_creditmemo_new>
|
36 |
+
<reference name="creditmemo_totals">
|
37 |
+
<block type="adminhtml/sales_order_totals_item" name="fee" template="fee/sales/order/total.phtml">
|
38 |
+
</block>
|
39 |
+
</reference>
|
40 |
+
</adminhtml_sales_order_creditmemo_new>
|
41 |
+
|
42 |
+
<adminhtml_sales_order_creditmemo_updateqty>
|
43 |
+
<reference name="creditmemo_totals">
|
44 |
+
<block type="adminhtml/sales_order_totals_item" name="fee" template="fee/sales/order/total.phtml">
|
45 |
+
</block>
|
46 |
+
</reference>
|
47 |
+
</adminhtml_sales_order_creditmemo_updateqty>
|
48 |
+
|
49 |
+
<adminhtml_sales_order_creditmemo_view>
|
50 |
+
<reference name="creditmemo_totals">
|
51 |
+
<block type="adminhtml/sales_order_totals_item" name="fee.refunded" template="fee/sales/order/refunded.phtml">
|
52 |
+
<action method="setDisplayArea"><area>footer</area></action>
|
53 |
+
</block>
|
54 |
+
</reference>
|
55 |
+
</adminhtml_sales_order_creditmemo_view>
|
56 |
+
</layout>
|
app/design/adminhtml/default/default/layout/freightcenter/customware.xml
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout>
|
3 |
+
<!-- Here, we reference the XML node path of our route -->
|
4 |
+
<adminhtml_collect_index>
|
5 |
+
<reference name="content">
|
6 |
+
<!-- We also reference our block by namespacename_modulename/adminhtml_controllername, and name it uniquely -->
|
7 |
+
<block type="freightcenter_customware/adminhtml_collect" name="freightcenter_customware_collect" />
|
8 |
+
</reference>
|
9 |
+
</adminhtml_collect_index>
|
10 |
+
</layout>
|
app/design/adminhtml/default/default/layout/freightcenter_frieghtadmin.xml
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout>
|
3 |
+
<adminhtml_sales_order_view>
|
4 |
+
<reference name="sales_order_tabs">
|
5 |
+
<action method="addTab">
|
6 |
+
<name>order_view_tab_frieghtadmin</name>
|
7 |
+
<block>frieghtadmin/adminhtml_order_view_tab_frieghtadmin</block>
|
8 |
+
</action>
|
9 |
+
</reference>
|
10 |
+
</adminhtml_sales_order_view>
|
11 |
+
</layout>
|
app/design/adminhtml/default/default/layout/frieghtadmin.xml
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout>
|
3 |
+
<adminhtml_sales_order_view>
|
4 |
+
<reference name="sales_order_tabs">
|
5 |
+
|
6 |
+
<block type="frieghtadmin/adminhtml_sales_order_view_tab_frieghtadmin" name="tab_frieghtadmin" template="frieghtadmin/sales/order/view/tab/frieghtadmin.phtml">
|
7 |
+
|
8 |
+
</block>
|
9 |
+
|
10 |
+
<action method="addTab">
|
11 |
+
<name>frieghtadmin</name>
|
12 |
+
<block>frieghtadmin/adminhtml_sales_order_view_tab_frieghtadmin</block>
|
13 |
+
</action>
|
14 |
+
</reference>
|
15 |
+
</adminhtml_sales_order_view>
|
16 |
+
</layout>
|
app/design/adminhtml/default/default/template/fee/sales/order/refunded.phtml
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if($this->getSource() instanceof Mage_Sales_Model_Order){ ?>
|
2 |
+
<?php if ((float) $this->getSource()->getFeeAmountRefunded()): ?>
|
3 |
+
<tr>
|
4 |
+
<td class="label"><strong><?php echo Mage::helper('fee')->__('Fee refunded to customer') ?></strong></td>
|
5 |
+
<td><strong><?php echo $this->getSource()->getFeeAmountRefunded(); ?></strong></td>
|
6 |
+
</tr>
|
7 |
+
<?php endif; ?>
|
8 |
+
<?php } else { ?>
|
9 |
+
<?php if ((float) $this->getSource()->getFeeAmount()): ?>
|
10 |
+
<tr>
|
11 |
+
<td class="label"><strong><?php echo Mage::helper('fee')->__('Fee Refunded') ?></strong></td>
|
12 |
+
<td><strong><?php echo $this->getSource()->getFeeAmount(); ?></strong></td>
|
13 |
+
</tr>
|
14 |
+
<?php endif;
|
15 |
+
}?>
|
16 |
+
|
app/design/adminhtml/default/default/template/fee/sales/order/total.phtml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $this->setPriceDataObject($this->getSource()) ?>
|
2 |
+
<?php if ((float) $this->getSource()->getFeeAmount()): ?>
|
3 |
+
<tr>
|
4 |
+
<td class="label"><?php echo Mage::helper('fee')->formatFee($this->getSource()->getFeeAmount()) ?></td>
|
5 |
+
<td>
|
6 |
+
<?php echo $this->displayPrices($this->getSource()->getBaseFeeAmount(), $this->getSource()->getFeeAmount()); ?>
|
7 |
+
</td>
|
8 |
+
</tr>
|
9 |
+
<?php endif; ?>
|
app/design/adminhtml/default/default/template/freightcenter/frieghtadmin/order/view/tab/frieghtadmin.phtml
ADDED
@@ -0,0 +1,1068 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
|
3 |
+
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
|
4 |
+
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
|
5 |
+
<link rel="stylesheet" href="/resources/demos/style.css">
|
6 |
+
<style>
|
7 |
+
.admin_view div{
|
8 |
+
margin-top: 3px;
|
9 |
+
padding: 2px;
|
10 |
+
}
|
11 |
+
.admin_view > span {
|
12 |
+
float: left;
|
13 |
+
padding: 3px;
|
14 |
+
}
|
15 |
+
.new_class{
|
16 |
+
background-color: hsl(26, 88%, 46%); border: 1px solid hsl(17, 100%, 27%); border-radius: 5px; float: right; margin-right: 20px; padding: 2px; text-align: center; width: 100px; color: hsl(0, 0%, 100%); cursor:pointer;
|
17 |
+
}
|
18 |
+
.new_class_bol{background-color: hsl(26, 88%, 46%); border: 1px solid hsl(17, 100%, 27%); border-radius: 5px; float: right; margin-right: 20px; padding: 2px; text-align: center; width: 100px; color: hsl(0, 0%, 100%); cursor:pointer; text-decoration: none;}
|
19 |
+
.success-msg-w{
|
20 |
+
background-color: hsl(0, 100%, 50%);
|
21 |
+
color:white;
|
22 |
+
}
|
23 |
+
|
24 |
+
</style>
|
25 |
+
<ul class="messages" style="display:none"><li class="success-msg"><ul><li><span id="append_ware">Shipment successfully booked for:</span></li></ul></li></ul>
|
26 |
+
<ul class="messages_error" style="display:none"><li class="" style=" background: #F9927E;color: hsl(0, 0%, 100%);padding: 10px;"><ul><li><span id="append_ware_error"></span></li></ul></li></ul>
|
27 |
+
<ul class="messages_ship" style="display:none;"><li class="success-msg" style="padding: 10px;"><ul><li><span id="append_ware_ship" style="margin-left:30px; font-weight: bold;">shipment successfully canceled for:</span></li></ul></li></ul>
|
28 |
+
<ul class="messages_ship_w" style="display:none; background: #F9927E;color: hsl(0, 0%, 100%);"><li class="success-msg-w" style="padding: 10px; "><ul><li><span id="append_ware_ship_w" style="margin-left:30px;"></span></li></ul></li></ul>
|
29 |
+
<ul class="messages_ship_error" style="display:none"><li class="" style=" background: #F9927E;color: hsl(0, 0%, 100%);padding: 10px;"><ul><li><span id="append_ware_ship_error"></span></li></ul></li></ul>
|
30 |
+
|
31 |
+
|
32 |
+
|
33 |
+
|
34 |
+
<?php
|
35 |
+
//echo "hello";
|
36 |
+
/* require_once 'app/Mage.php';
|
37 |
+
umask(0);
|
38 |
+
Mage::app('default'); */
|
39 |
+
/* resource = Mage::getSingleton('core/resource');
|
40 |
+
$readConnection = $resource->getConnection('core_read');
|
41 |
+
$tableNamep = $resource->getTableName('brst_ship_warehouses'); */
|
42 |
+
$admin = Mage::getSingleton('admin/session')->getUser();
|
43 |
+
$name = $admin->getName();
|
44 |
+
?>
|
45 |
+
<input type="hidden" name="agent" id="agent" value="<?php echo $name; ?>" />
|
46 |
+
<?php
|
47 |
+
|
48 |
+
|
49 |
+
function empty_ak($data)
|
50 |
+
{
|
51 |
+
if($data!=''){return $data;}
|
52 |
+
else {return " ";}
|
53 |
+
}
|
54 |
+
$collection = Mage::getModel('catalog/product')->getCollection();
|
55 |
+
$myarray=array();
|
56 |
+
foreach ($collection as $product_all)
|
57 |
+
{
|
58 |
+
//echo '<pre>';print_r($product);echo '</pre>';
|
59 |
+
$sku = $product_all['sku'];
|
60 |
+
$product_id = Mage::getModel('catalog/product')->getIdBySku($sku);
|
61 |
+
$product = Mage::getModel('catalog/product');
|
62 |
+
$product ->load($product_id);
|
63 |
+
$pk_f = empty_ak($product['ship_via_freight']);
|
64 |
+
if($pk_f!=1)
|
65 |
+
continue;
|
66 |
+
$myarray[]=$product;
|
67 |
+
|
68 |
+
}
|
69 |
+
$_order = $this->getOrder();
|
70 |
+
$order_id = $_order->getId();
|
71 |
+
$order_add = Mage::getModel('sales/order')->load($order_id);
|
72 |
+
$shippingId = $order_add->getShippingAddress()->getId();
|
73 |
+
$address = Mage::getModel('sales/order_address')->load($shippingId);
|
74 |
+
$order = Mage::getModel("sales/order")->load($order_id);
|
75 |
+
$ordered_items = $order->getAllItems();
|
76 |
+
//echo '<pre>'; print_r($address); echo '</pre>';
|
77 |
+
$quote_id = $order->getQuoteId();
|
78 |
+
//echo $qtyordered = $item->getQty();
|
79 |
+
$grandtotal = $order->getGrandTotal();
|
80 |
+
foreach($address as $addre){
|
81 |
+
if($addre['postcode']){
|
82 |
+
$pincode = $addre['postcode'];
|
83 |
+
}
|
84 |
+
if($addre['email']){
|
85 |
+
$email = $addre['email'];
|
86 |
+
}
|
87 |
+
if($addre['company']){
|
88 |
+
$company = $addre['company'];
|
89 |
+
}
|
90 |
+
if($addre['firstname']){
|
91 |
+
$firstname = $addre['firstname'];
|
92 |
+
}if($addre['lastname']){
|
93 |
+
$lastname = $addre['lastname'];
|
94 |
+
}if($addre['telephone']){
|
95 |
+
$telephone = $addre['telephone'];
|
96 |
+
}if($addre['street']){
|
97 |
+
$street = $addre['street'];
|
98 |
+
}if($addre['city']){
|
99 |
+
$city = $addre['city'];
|
100 |
+
}
|
101 |
+
if($addre['region']){
|
102 |
+
$region = $addre['region'];
|
103 |
+
}if($addre['country_id']){
|
104 |
+
$country_id = $addre['country_id'];
|
105 |
+
}
|
106 |
+
}
|
107 |
+
|
108 |
+
$ware_count = array();
|
109 |
+
|
110 |
+
foreach($ordered_items as $item)
|
111 |
+
{
|
112 |
+
//$or_id = $item->getItemId();
|
113 |
+
|
114 |
+
$or_id = $item['product_id'];
|
115 |
+
|
116 |
+
|
117 |
+
$product_sku = $item['sku'];
|
118 |
+
$product_price = $item['price'];
|
119 |
+
//echo $quote_id = $item['quote_id'];
|
120 |
+
//echo "foreach1";
|
121 |
+
//echo '<pre>'; print_r($myarray); echo '</pre>';
|
122 |
+
$product_count = array();
|
123 |
+
foreach($myarray as $frieght)
|
124 |
+
{
|
125 |
+
//echo "foreach2";
|
126 |
+
//echo $frieght['ship_via_freight'];
|
127 |
+
$id = $frieght['entity_id'];
|
128 |
+
|
129 |
+
|
130 |
+
if($id == $or_id)
|
131 |
+
{
|
132 |
+
$qty_ordered = $item['qty_ordered'];
|
133 |
+
$product_sku = $item['sku'];
|
134 |
+
$product_name = $item['name'];
|
135 |
+
|
136 |
+
//echo "if condition";
|
137 |
+
// echo $frieght['origin_warehouse'];
|
138 |
+
// echo $id = $frieght['entity_id'];
|
139 |
+
$nmfc = $frieght['nmfc'];
|
140 |
+
$freight_length = $frieght['freight_length'];
|
141 |
+
$freight_width = $frieght['freight_width'];
|
142 |
+
$freight_height = $frieght['freight_height'];
|
143 |
+
|
144 |
+
$attribute2= Mage::getModel('eav/config')->getAttribute('catalog_product', 'freight_class');
|
145 |
+
foreach ( $attribute2->getSource()->getAllOptions(true, true) as $opt_menu_f)
|
146 |
+
{
|
147 |
+
$m1_attribute_f[$opt_menu_f['value']] = $opt_menu_f['label'];
|
148 |
+
}
|
149 |
+
$freight_class = $m1_attribute_f[$frieght['freight_class']];
|
150 |
+
$hazardous_materials = $frieght['hazardous_materials'];
|
151 |
+
$packaging_type = $frieght['packaging_type'];
|
152 |
+
$short_description = $frieght['short_description'];
|
153 |
+
$origin_warehouse = $frieght['origin_warehouse'];
|
154 |
+
$weight = $frieght['weight'];
|
155 |
+
$attribute1 = Mage::getModel('eav/config')->getAttribute('catalog_product', 'origin_warehouse');
|
156 |
+
foreach ( $attribute1->getSource()->getAllOptions(true, true) as $opt_menu)
|
157 |
+
{
|
158 |
+
$m1_attribute[$opt_menu['value']] = $opt_menu['label'];
|
159 |
+
}
|
160 |
+
$home_url = Mage::helper('core/url')->getHomeUrl();
|
161 |
+
$home = explode("index.php", $home_url);
|
162 |
+
//echo '<pre>'; print_r($home);exit;
|
163 |
+
$hello = $home[0];
|
164 |
+
|
165 |
+
?>
|
166 |
+
|
167 |
+
<input type="hidden" value="<?php echo $hello; ?>" id="url_api" />
|
168 |
+
<?php
|
169 |
+
//echo "<pre>";print_r($m1_attribute);
|
170 |
+
$ware_id = $m1_attribute[$frieght['origin_warehouse']];
|
171 |
+
$product_count[] = $qty_ordered;
|
172 |
+
$product_count[] = $product_sku;
|
173 |
+
$product_count[] = $product_name;
|
174 |
+
$product_count[] = $ware_id;
|
175 |
+
$new_product_count[] = $product_count;
|
176 |
+
$product_count= array();
|
177 |
+
$ware_count[] = $m1_attribute[$frieght['origin_warehouse']];
|
178 |
+
$resource = Mage::getSingleton('core/resource');
|
179 |
+
$readConnection = $resource->getConnection('core_read');
|
180 |
+
$tableNamep = $resource->getTableName('brst_ship_warehouses');
|
181 |
+
$tableNamep_ship = $resource->getTableName('brst_freight_shipping');
|
182 |
+
$queryp = "SELECT * FROM $tableNamep WHERE short_name = '$ware_id' ";
|
183 |
+
$breakout_lineitems = Mage::getStoreConfig('carriers/freightcenter/breakout_lineitems');
|
184 |
+
//if($breakout_lineitems == '1'){
|
185 |
+
$queryp_ship = 'SELECT * FROM ' . $tableNamep_ship. ' WHERE quote_id = ' . $quote_id . ' AND product_id = ' . $or_id . ' ORDER BY `quote_id` DESC LIMIT 1' ;
|
186 |
+
//}
|
187 |
+
//else{
|
188 |
+
//$queryp_ship = 'SELECT * FROM ' . $tableNamep_ship. ' WHERE quote_id = ' . $quote_id . ' ORDER BY `quote_id` DESC LIMIT 1' ;
|
189 |
+
//}
|
190 |
+
$results = $readConnection->fetchAll($queryp);
|
191 |
+
//echo $count = count($results);
|
192 |
+
$results_ship = $readConnection->fetchAll($queryp_ship);
|
193 |
+
$MarkupType = Mage::getStoreConfig('carriers/freightcenter/markup_type');
|
194 |
+
$MarkupPrice = Mage::getStoreConfig('carriers/freightcenter/markup_price');
|
195 |
+
$Markuptypeadd = Mage::getStoreConfig('carriers/freightcenter/markup');
|
196 |
+
$sandbox = Mage::getStoreConfig('carriers/freightcenter/sandbox');
|
197 |
+
?>
|
198 |
+
<input type ="hidden" id="sand" value="<?php echo $sandbox; ?>" />
|
199 |
+
<?php
|
200 |
+
foreach($results_ship as $result_ship){
|
201 |
+
$final_dest = $result_ship['final_dest'];
|
202 |
+
$carrier_name = $result_ship['carrier_name'];
|
203 |
+
$bookingno = $result_ship['bookingno'];
|
204 |
+
$status = $result_ship['status'];
|
205 |
+
$date_from = $result_ship['date_from'];
|
206 |
+
$date_to = $result_ship['date_to'];
|
207 |
+
$ship_product_id = $result_ship['product_id'];
|
208 |
+
$shipping_charge = $result_ship['shipping_charge'];
|
209 |
+
$grandship = $result_ship['grandship'];
|
210 |
+
$rateid = $result_ship['rateid'];
|
211 |
+
$warehouse_name = $result_ship['warehouse_name'];
|
212 |
+
$days = $result_ship['days'];
|
213 |
+
}
|
214 |
+
//echo '<pre>'; print_r($results);
|
215 |
+
$one = 200;
|
216 |
+
$two = 400;
|
217 |
+
/* if($Markuptypeadd == 'markup'){
|
218 |
+
if($MarkupType == 'percent'){
|
219 |
+
$gettotal_pr = ($shipping_charge * $MarkupPrice)/100;
|
220 |
+
$gettotal_shipping = $shipping_charge + $gettotal_pr;
|
221 |
+
}
|
222 |
+
else{
|
223 |
+
$gettotal_shipping = $shipping_charge + $MarkupPrice ;
|
224 |
+
}
|
225 |
+
}
|
226 |
+
if($Markuptypeadd == 'none'){
|
227 |
+
if($MarkupType == 'percent'){
|
228 |
+
// $gettotal_pr = ($shipping_charge * $MarkupPrice)/100;
|
229 |
+
$gettotal_shipping = $shipping_charge;
|
230 |
+
}
|
231 |
+
else{
|
232 |
+
$gettotal_shipping = $shipping_charge;
|
233 |
+
}
|
234 |
+
}
|
235 |
+
if($Markuptypeadd == 'discount'){
|
236 |
+
if($MarkupType == 'percent'){
|
237 |
+
$gettotal_pr = ($shipping_charge * $MarkupPrice)/100;
|
238 |
+
$gettotal_shipping = $shipping_charge - $gettotal_pr;
|
239 |
+
}
|
240 |
+
else{
|
241 |
+
$gettotal_shipping = $shipping_charge - $MarkupPrice ;
|
242 |
+
}
|
243 |
+
} */
|
244 |
+
/* $breakout_lineitems = Mage::getStoreConfig('carriers/freightcenter/breakout_lineitems');
|
245 |
+
if($breakout_lineitems == '1'){ */
|
246 |
+
$ware_house = array();
|
247 |
+
foreach($results as $ware_result)
|
248 |
+
{
|
249 |
+
if($ship_product_id == $id){
|
250 |
+
$ware_house['first_name'] = $ware_result['first_name'];
|
251 |
+
$ware_house['short_name'] = $ware_result['short_name'];
|
252 |
+
$ware_house['phone'] = $ware_result['phone'];
|
253 |
+
$ware_house['cmpny_postcode'] = $ware_result['cmpny_postcode'];
|
254 |
+
$ware_house['street'] = $ware_result['street'];
|
255 |
+
$ware_house['city'] = $ware_result['city'];
|
256 |
+
$ware_house['state'] = $ware_result['state'];
|
257 |
+
$ware_house['last_name'] = $ware_result['last_name'];
|
258 |
+
$ware_house['accessorials'] = $ware_result['accessorials'];
|
259 |
+
$ware_house['email'] = $ware_result['email'];
|
260 |
+
$ware_house['hours'] = $ware_result['hours'];
|
261 |
+
$ware_house['cmpny_name'] = $ware_result['cmpny_name'];
|
262 |
+
$ware_house['pro_qty'] = $item['qty_ordered'];
|
263 |
+
$ware_house['pro_sku'] = $item['sku'];
|
264 |
+
$ware_house['pro_name'] = $item['name'];
|
265 |
+
$ware_house['pro_id'] = $frieght['entity_id'];
|
266 |
+
$ware_house['quote_id'] = $quote_id;
|
267 |
+
$ware_house['add_firstname'] = $firstname;
|
268 |
+
$ware_house['add_street'] = $street;
|
269 |
+
$ware_house['add_city'] = $city;
|
270 |
+
$ware_house['add_region'] = $region;
|
271 |
+
$ware_house['add_country_id'] = $country_id;
|
272 |
+
$ware_house['add_pincode'] = $pincode;
|
273 |
+
$ware_house['carrier_name'] = $carrier_name;
|
274 |
+
$ware_house['final_dest'] = $final_dest;
|
275 |
+
$ware_house['shipping_charge'] = $result_ship['shipping_charge'];
|
276 |
+
$ware_house['grandship'] = $result_ship['grandship'];
|
277 |
+
$ware_house['gettotal_shipping'] = $gettotal_shipping;
|
278 |
+
$ware_house['warehouse_name'] = $warehouse_name ;
|
279 |
+
$ware_house['bookingno'] = $bookingno;
|
280 |
+
$ware_house['date_from'] = $date_from;
|
281 |
+
$ware_house['rateid'] = $rateid;
|
282 |
+
$ware_house['days'] = $days;
|
283 |
+
$newArr[] = $ware_house;
|
284 |
+
$ware_house = array();
|
285 |
+
|
286 |
+
}
|
287 |
+
}
|
288 |
+
/* }
|
289 |
+
else{
|
290 |
+
$ware_house = array();
|
291 |
+
foreach($results as $ware_result)
|
292 |
+
{
|
293 |
+
//if($ship_product_id == $id){
|
294 |
+
$ware_house['first_name'] = $ware_result['first_name'];
|
295 |
+
$ware_house['short_name'] = $ware_result['short_name'];
|
296 |
+
$ware_house['phone'] = $ware_result['phone'];
|
297 |
+
$ware_house['cmpny_postcode'] = $ware_result['cmpny_postcode'];
|
298 |
+
$ware_house['street'] = $ware_result['street'];
|
299 |
+
$ware_house['city'] = $ware_result['city'];
|
300 |
+
$ware_house['state'] = $ware_result['state'];
|
301 |
+
$ware_house['last_name'] = $ware_result['last_name'];
|
302 |
+
$ware_house['accessorials'] = $ware_result['accessorials'];
|
303 |
+
$ware_house['pro_qty'] = $item['qty_ordered'];
|
304 |
+
$ware_house['pro_sku'] = $item['sku'];
|
305 |
+
$ware_house['pro_name'] = $item['name'];
|
306 |
+
$ware_house['pro_id'] = $frieght['entity_id'];
|
307 |
+
$ware_house['quote_id'] = $quote_id;
|
308 |
+
$ware_house['add_firstname'] = $firstname;
|
309 |
+
$ware_house['add_street'] = $street;
|
310 |
+
$ware_house['add_city'] = $city;
|
311 |
+
$ware_house['add_region'] = $region;
|
312 |
+
$ware_house['add_country_id'] = $country_id;
|
313 |
+
$ware_house['add_pincode'] = $pincode;
|
314 |
+
$ware_house['carrier_name'] = $carrier_name;
|
315 |
+
$ware_house['shipping_charge'] = $result_ship['shipping_charge'];
|
316 |
+
$ware_house['gettotal_shipping'] = $gettotal_shipping;
|
317 |
+
$ware_house['warehouse_name'] = $warehouse_name ;
|
318 |
+
$ware_house['bookingno'] = $bookingno;
|
319 |
+
$ware_house['date_from'] = $date_from;
|
320 |
+
$newArr[] = $ware_house;
|
321 |
+
$ware_house = array();
|
322 |
+
|
323 |
+
//}
|
324 |
+
}
|
325 |
+
} */
|
326 |
+
// echo '<pre>'; print_r($ware_house); echo '</pre>';
|
327 |
+
foreach($results as $ware_result)
|
328 |
+
{
|
329 |
+
$ware_first_name = $ware_result['first_name'];
|
330 |
+
$ware_short_name = $ware_result['short_name'];
|
331 |
+
$ware_phone = $ware_result['phone'];
|
332 |
+
$ware_cmpny_postcode = $ware_result['cmpny_postcode'];
|
333 |
+
$ware_street = $ware_result['street'];
|
334 |
+
$ware_city = $ware_result['city'];
|
335 |
+
$ware_state = $ware_result['state'];
|
336 |
+
$ware_country_id = $ware_result['country_id'];
|
337 |
+
$ware_last_name = $ware_result['last_name'];
|
338 |
+
$accessorials = $ware_result['accessorials'];
|
339 |
+
$accessorials = explode(',', $accessorials);
|
340 |
+
//print_r($accessorials);
|
341 |
+
$accessorialsdisplay = count($accessorials);
|
342 |
+
$print_accessorials = '';
|
343 |
+
for($modz=0;$modz<$accessorialsdisplay; $modz++){
|
344 |
+
|
345 |
+
//$print_accessorials ="<p>".$accessorials[$modz]."</p>"
|
346 |
+
if($accessorials[$modz] == '1'){
|
347 |
+
$print_accessorials .="<p>Include A Lift Gate At Pickup</p>" ;
|
348 |
+
}
|
349 |
+
if($accessorials[$modz] == '2'){
|
350 |
+
$print_accessorials .="<p>Is Limited Access Pickup Area</p>" ;
|
351 |
+
}
|
352 |
+
if($accessorials[$modz] == '3'){
|
353 |
+
$print_accessorials .="<p>Is Inside Pickup</p>" ;
|
354 |
+
}
|
355 |
+
if($accessorials[$modz] == '4'){
|
356 |
+
$print_accessorials .="<p>Call For Pickup Appointment</p>" ;
|
357 |
+
}
|
358 |
+
}
|
359 |
+
|
360 |
+
//echo $print_accessorials;
|
361 |
+
?>
|
362 |
+
|
363 |
+
|
364 |
+
|
365 |
+
|
366 |
+
<?php
|
367 |
+
|
368 |
+
|
369 |
+
|
370 |
+
}
|
371 |
+
|
372 |
+
}
|
373 |
+
|
374 |
+
}
|
375 |
+
|
376 |
+
|
377 |
+
|
378 |
+
}
|
379 |
+
|
380 |
+
/* $ware_count = array_unique($ware_count);
|
381 |
+
$j=0;
|
382 |
+
for($j==0;$j<=2-1;$j++)
|
383 |
+
{
|
384 |
+
// echo $ware_count[$j]."</br>";
|
385 |
+
|
386 |
+
$query_count = "SELECT * FROM $tableNamep WHERE short_name = '$ware_count[$j]' ";
|
387 |
+
$results_count = $readConnection->fetchAll($query_count);
|
388 |
+
//echo '<pre>'; print_r($results_count); echo '</pre>';
|
389 |
+
foreach($results_count as $result_count ){
|
390 |
+
//echo $ware_count_name= $result_count['short_name'];
|
391 |
+
}
|
392 |
+
|
393 |
+
} */
|
394 |
+
//echo '<pre>'; print_r($newArr); echo '</pre>';
|
395 |
+
|
396 |
+
$ware_count = array_unique($ware_count);
|
397 |
+
$j=0;
|
398 |
+
for($j==0;$j<=count($ware_count)-1;$j++)
|
399 |
+
{
|
400 |
+
// echo $ware_count[$j]."</br>";
|
401 |
+
|
402 |
+
$query_count = "SELECT * FROM $tableNamep WHERE short_name = '$ware_count[$j]' ";
|
403 |
+
$results_count = $readConnection->fetchAll($query_count);
|
404 |
+
//echo '<pre>'; print_r($results_count); echo '</pre>';
|
405 |
+
foreach($results_count as $result_count ){
|
406 |
+
$ware_count_name= $result_count['short_name'];
|
407 |
+
$i=0;
|
408 |
+
|
409 |
+
for($i==0;$i<=count($ware_count)-1;$i++)
|
410 |
+
{
|
411 |
+
if($ware_count_name == $newArr[$i]['short_name']){
|
412 |
+
|
413 |
+
$ware_first_name = $newArr[$i]['first_name'];
|
414 |
+
$ware_short_name = $newArr[$i]['short_name'];
|
415 |
+
$ware_phone = $newArr[$i]['phone'];
|
416 |
+
$ware_cmpny_postcode = $newArr[$i]['cmpny_postcode'];
|
417 |
+
$ware_street = $newArr[$i]['street'];
|
418 |
+
$ware_city = $newArr[$i]['city'];
|
419 |
+
$ware_state = $newArr[$i]['state'];
|
420 |
+
$ware_country_id = $newArr[$i]['country_id'];
|
421 |
+
$ware_last_name = $newArr[$i]['last_name'];
|
422 |
+
$ware_email = $newArr[$i]['email'];
|
423 |
+
$ware_hours = $newArr[$i]['hours'];
|
424 |
+
$ware_comp_name = $newArr[$i]['cmpny_name'];
|
425 |
+
$qty_ordered = $newArr[$i]['pro_qty'];
|
426 |
+
$sku = $newArr[$i]['pro_sku'];
|
427 |
+
$pro_name = $newArr[$i]['pro_name'];
|
428 |
+
$or_id = $newArr[$i]['pro_id'];
|
429 |
+
$quote_id = $newArr[$i]['quote_id'];
|
430 |
+
$firstname = $newArr[$i]['add_firstname'];
|
431 |
+
$street = $newArr[$i]['add_street'];
|
432 |
+
$rateid = $newArr[$i]['rateid'];
|
433 |
+
$city = $newArr[$i]['add_city'];
|
434 |
+
$region = $newArr[$i]['add_region'];
|
435 |
+
$country_id = $newArr[$i]['add_country_id'];
|
436 |
+
$pincode = $newArr[$i]['add_pincode'];
|
437 |
+
$carrier_name = $newArr[$i]['carrier_name'];
|
438 |
+
$final_dest = $newArr[$i]['final_dest'];
|
439 |
+
$shipping_charge = $newArr[$i]['shipping_charge'];
|
440 |
+
$grandship = $newArr[$i]['grandship'];
|
441 |
+
$gettotal_shipping = $newArr[$i]['gettotal_shipping'];
|
442 |
+
$warehouse_name = $newArr[$i]['warehouse_name'];
|
443 |
+
$bookingno = $newArr[$i]['bookingno'];
|
444 |
+
$days = $newArr[$i]['days'];
|
445 |
+
$date_from = $newArr[$i]['date_from'];
|
446 |
+
$accessorials = $newArr[$i]['accessorials'];
|
447 |
+
$accessorials = explode(',', $accessorials);
|
448 |
+
//print_r($accessorials);
|
449 |
+
$accessorialsdisplay = count($accessorials);
|
450 |
+
$print_accessorials = '';
|
451 |
+
for($modz=0;$modz<$accessorialsdisplay; $modz++){
|
452 |
+
|
453 |
+
//$print_accessorials ="<p>".$accessorials[$modz]."</p>"
|
454 |
+
if($accessorials[$modz] == '1'){
|
455 |
+
$print_accessorials .="<p>Include A Lift Gate At Pickup</p>" ;
|
456 |
+
}
|
457 |
+
if($accessorials[$modz] == '2'){
|
458 |
+
$print_accessorials .="<p>Is Limited Access Pickup Area</p>" ;
|
459 |
+
}
|
460 |
+
if($accessorials[$modz] == '3'){
|
461 |
+
$print_accessorials .="<p>Is Inside Pickup</p>" ;
|
462 |
+
}
|
463 |
+
if($accessorials[$modz] == '4'){
|
464 |
+
$print_accessorials .="<p>Call For Pickup Appointment</p>" ;
|
465 |
+
}
|
466 |
+
}
|
467 |
+
$pr_new = array();
|
468 |
+
foreach($new_product_count as $value){
|
469 |
+
//print_r($value);
|
470 |
+
|
471 |
+
if($value[3] == $ware_short_name ) {
|
472 |
+
//print_r($val);
|
473 |
+
$pr_new['qty'] = $value['0'];
|
474 |
+
$pr_new['sku'] = $value['1'];
|
475 |
+
$pr_new['name'] = $value['2'];
|
476 |
+
}
|
477 |
+
}
|
478 |
+
//echo '<pre>'; print_r($pr_new); echo '<pre>';
|
479 |
+
|
480 |
+
|
481 |
+
|
482 |
+
|
483 |
+
?>
|
484 |
+
|
485 |
+
|
486 |
+
|
487 |
+
<?php //if( $final_dest != ''){ ?>
|
488 |
+
<?php //if($bookingno > 0 && $ware_first_name == $warehouse_name){
|
489 |
+
?>
|
490 |
+
<!-- <ul class="messages_ship" style="display:none;"><li class="success-msg" style="padding: 10px;"><ul><li><span id="append_ware_ship" style="margin-left:30px;">shipment successfully canceled for:</span></li></ul></li></ul> -->
|
491 |
+
|
492 |
+
<?php// } else { ?>
|
493 |
+
<!--<ul class="messages" style="display:block"><li class="success-msg"><ul><li><span id="append_ware">Shipment successfully booked for:</span></li></ul></li></ul> -->
|
494 |
+
|
495 |
+
<?php //}
|
496 |
+
// } ?>
|
497 |
+
|
498 |
+
|
499 |
+
|
500 |
+
|
501 |
+
|
502 |
+
|
503 |
+
|
504 |
+
|
505 |
+
<div style="width:800px; float:left; margin-top: 5px; " id="<?php echo $or_id; ?>">
|
506 |
+
<div style="width: 750px; background: none repeat scroll 0% 0% rgb(111, 137, 146); text-align: left; padding: 1px 0px 1px 1px; height: 21px; border: 1px solid rgb(251, 145, 62);">
|
507 |
+
<h4 style="color:white; float:left">Shipping From: <?php echo $ware_short_name; ?></h4>
|
508 |
+
<h4 style="color:white; float:right; margin-right:10px;" id="quote<?php echo $or_id; ?>"> <?php
|
509 |
+
if($final_dest != ''){
|
510 |
+
if($bookingno > 0 && $ware_first_name == $warehouse_name){ ?> Quote ID: <?php echo $bookingno;?> - Booked<?php } else{
|
511 |
+
|
512 |
+
$quote_id; } }
|
513 |
+
|
514 |
+
?>
|
515 |
+
</h4>
|
516 |
+
</div>
|
517 |
+
<div style="width: 750px; border: 1px solid rgb(214, 214, 214); background: none repeat scroll 0% 0% rgb(250, 250, 250);float: left;" class="admin_view">
|
518 |
+
<div style=" border-bottom: 1px solid hsl(0, 0%, 84%); height: 194px; margin-bottom: 10px; margin-left: 50px; margin-right: 50px;">
|
519 |
+
<div style="float:left; margin-left:20px;">
|
520 |
+
<h4>From:</h4>
|
521 |
+
<p><h4><?php echo $ware_first_name; ?></h4></p>
|
522 |
+
<p><?php echo $ware_street; ?> ,<?php echo $ware_city; ?></p>
|
523 |
+
<p><?php echo $ware_state; ?>, <?php echo $ware_country_id; ?> <?php echo $ware_cmpny_postcode; ?></p>
|
524 |
+
<p></p>
|
525 |
+
<div style="float: left; ">
|
526 |
+
<p><?php echo $print_accessorials; ?></p></div>
|
527 |
+
</div>
|
528 |
+
<div style="float:right; margin-right:20px;">
|
529 |
+
<h4>To:</h4>
|
530 |
+
<p><h4><?php echo $firstname; ?></h4></p>
|
531 |
+
<p><?php echo $street; ?> ,<?php echo $city; ?></p>
|
532 |
+
<p><?php echo $region; ?>, <?php echo $country_id; ?> <?php echo $pincode; ?></p>
|
533 |
+
<p></p>
|
534 |
+
<p><?php //echo $print_accessorials; ?></p>
|
535 |
+
</div>
|
536 |
+
</div>
|
537 |
+
<div style="float: left; height: 170px; border-bottom: 1px solid rgb(213, 213, 213); margin-bottom: 20px; width: 550px; margin-left: 50px; margin-right: 50px;">
|
538 |
+
<div style="align-self: center; "><p style="float: left; font-weight: bold;">CARRIER:</p> <span style="margin-left:30px;"><?php echo $carrier_name;?></span></div>
|
539 |
+
<div style="align-self: center; "><p style="float: left; font-weight: bold; margin-left: -26px;">PICKUP DATE:</p>
|
540 |
+
<input type="hidden" id="hidden_id" value="<?php echo $or_id; ?>" />
|
541 |
+
<span style="margin-left:30px;"><label for="from"></label>
|
542 |
+
<?php if($bookingno > 0 && $ware_first_name == $warehouse_name){
|
543 |
+
?>
|
544 |
+
<input type="text" readonly value="<?php echo $date_from; ?>" >
|
545 |
+
<?php }else { ?>
|
546 |
+
<input type="text" class="from" id="from<?php echo $or_id; ?>" name="from">
|
547 |
+
<img src="<?php echo $hello; ?>/skin/adminhtml/default/default/images/grid-cal.gif" alt="" style="margin-top: 3px; position: absolute; margin-left: 5px;" /><?php } ?>
|
548 |
+
<input type="hidden" class="to" name="to" id="to<?php echo $or_id; ?>">
|
549 |
+
</span>
|
550 |
+
</div>
|
551 |
+
<div style="align-self: center; "><p style="float: left; font-weight: bold; margin-left: -31px;">Estimated Transit Time:</p> <span style="margin-left:30px;"><?php if($days > 0){ echo $days;}else{ echo 2; } ?> Days</span></div>
|
552 |
+
<div style="align-self: center; "><p style="float: left; font-weight: bold; margin-left: 16px;">COST:</p> <span style="margin-left:30px;">$<?php echo $grandship = number_format($grandship, 2, '.', ',');?></span></div>
|
553 |
+
<div style="align-self: center; "><p style="float: left; font-weight: bold;">CHARGE:</p> <span style="margin-left:30px;">$<?php echo $shipping_charge = number_format($shipping_charge, 2, '.', ',');?></span></div>
|
554 |
+
</div>
|
555 |
+
<!--<div style="float: left; margin-left: 50px; height: auto; border-bottom: 1px solid rgb(213, 213, 213); margin-bottom: 20px; width: 550px;">
|
556 |
+
<div style="float:left;">
|
557 |
+
<h4 style=" text-transform: uppercase;">items ordered from this warehouse: (<?php //echo round($qty_ordered); ?> ITEMS)</h4>
|
558 |
+
</div>
|
559 |
+
<table style="width:588px">
|
560 |
+
<tr>
|
561 |
+
<th>Product</th>
|
562 |
+
<th>SKU</th>
|
563 |
+
<th>Quantity</th>
|
564 |
+
</tr>
|
565 |
+
<?php ?>
|
566 |
+
<tr>
|
567 |
+
<td><?php //echo $pr_new['name']; ?></td>
|
568 |
+
<td><?php //echo $pr_new['sku']; ?></td>
|
569 |
+
<td><?php //echo round($pr_new['qty']); ?></td>
|
570 |
+
</tr>
|
571 |
+
<?php ?>
|
572 |
+
|
573 |
+
</table>
|
574 |
+
|
575 |
+
</div> -->
|
576 |
+
<?php if( $final_dest != ''){ ?>
|
577 |
+
<?php if($bookingno > 0 && $ware_first_name == $warehouse_name){
|
578 |
+
}else { ?>
|
579 |
+
<div id="accept<?php echo $or_id; ?>" style="float: left; margin-left: 50px; height: auto; border-bottom: 1px solid rgb(213, 213, 213); margin-bottom: 20px; width: 550px;">
|
580 |
+
<input type="checkbox" id="accept_term<?php echo $or_id; ?>" value="1" />
|
581 |
+
<span>I Agree to the FreightCenter <a href="http://www.freightcenter.com/forms/terms%20and%20conditions/terms%20and%20conditions.pdf" target="_blank" style="text-decoration: none; font-weight: bold; color: rgb(26, 107, 187); ">Terms & Conditions</a></span>
|
582 |
+
</div><?php } } ?>
|
583 |
+
<div style="float: right; width: 210px; display:none;" id="get_rate_ajax<?php echo $or_id; ?>">
|
584 |
+
|
585 |
+
<input type="hidden" value = "<?php echo $or_id; ?>" id="product_id"/>
|
586 |
+
|
587 |
+
</div>
|
588 |
+
<div id="ship_cancel_new<?php echo $or_id; ?>"></div>
|
589 |
+
<?php if( $final_dest != ''){ ?>
|
590 |
+
<?php if($bookingno > 0 && $ware_first_name == $warehouse_name){
|
591 |
+
?>
|
592 |
+
<div style="float: right; margin-right: 20px; margin-bottom: 10px;" id="ship_cancel<?php echo $or_id; ?>">
|
593 |
+
<div style=" background-color: hsl(26, 88%, 46%); border: 1px solid hsl(17, 100%, 27%); border-radius: 5px; float: right; margin-right: 20px; padding: 2px; text-align: center; width: 100px; color: hsl(0, 0%, 100%); cursor:pointer" onclick="cancel_api('<?php echo $bookingno; ?>', '<?php echo $ware_short_name; ?>', '<?php echo $or_id; ?>', '<?php echo $quote_id; ?>'); ">Cancel Booking</div>
|
594 |
+
<div style="float: right; display: none; height: 8px; margin-top: 4px;" class="pls-wait<?php echo $or_id; ?>">
|
595 |
+
|
596 |
+
|
597 |
+
|
598 |
+
<span id="loader_loctype<?php echo $or_id; ?>">
|
599 |
+
<img class="v-middle" title="Loading Booking..." alt="Loading carrier rates..." src="http://staging.brstdev.com/magento/skin/frontend/default/default/images/opc-ajax-loader.gif">
|
600 |
+
</span>
|
601 |
+
</div>
|
602 |
+
<script>
|
603 |
+
jQuery.noConflict();
|
604 |
+
jQuery( document ).ready(function() {
|
605 |
+
BOLcheck_first('<?php echo $bookingno; ?>', '<?php echo $or_id; ?>');
|
606 |
+
});
|
607 |
+
|
608 |
+
</script>
|
609 |
+
<?php if($sandbox == '1'){ ?>
|
610 |
+
<div id="withBol<?php echo $or_id; ?>" style="display:none; background-color: hsl(26, 88%, 46%); border: 1px solid hsl(17, 100%, 27%); border-radius: 5px; float: right; margin-right: 20px; padding: 2px; text-align: center; width: 100px; color: hsl(0, 0%, 100%); cursor:pointer"><a style="text-decoration: none; color: white;" target="_blank" href="https://sandbox.freightcenter.com/DownloadBol.aspx?qid=<?php echo $bookingno; ?>">Download BOL</a></div>
|
611 |
+
<?php } else { ?>
|
612 |
+
<div id="withBol<?php echo $or_id; ?>" style="display:none; background-color: hsl(26, 88%, 46%); border: 1px solid hsl(17, 100%, 27%); border-radius: 5px; float: right; margin-right: 20px; padding: 2px; text-align: center; width: 100px; color: hsl(0, 0%, 100%); cursor:pointer"><a style="text-decoration: none; color: white;" target="_blank" href="https://www.freightcenter.com/DownloadBol.aspx?qid=<?php echo $bookingno; ?>">Download BOL</a></div> <?php } ?></div>
|
613 |
+
<?php } else{ ?>
|
614 |
+
<div id = "ajax_call<?php echo $or_id; ?>" style=" background-color: hsl(26, 88%, 46%); border: 1px solid hsl(17, 100%, 27%); border-radius: 5px; float: right; margin-right: 20px; margin-top: 20px; padding: 2px; text-align: center; width: 100px; color: hsl(0, 0%, 100%); cursor:pointer" onclick="AdminGetRate('<?php echo $ware_first_name; ?>','<?php echo $ware_last_name; ?>','<?php echo $ware_phone; ?>','<?php echo $ware_cmpny_postcode; ?>','<?php echo $ware_street; ?>','<?php echo $ware_city; ?>','<?php echo $ware_state; ?>','<?php echo $ware_country_id; ?>','<?php echo $firstname; ?>','<?php echo $lastname; ?>', '<?php echo $telephone; ?>', '<?php echo $pincode; ?>', '<?php echo $street; ?>', '<?php echo $city;?>', '<?php echo $region; ?>', '<?php echo $country_id; ?>', '<?php echo $quote_id; ?>', '<?php echo $or_id; ?>', '<?php echo $rateid; ?>', '<?php echo $ware_short_name; ?>', '<?php echo $ware_hours; ?>', '<?php echo $ware_email; ?>', '<?php echo $ware_comp_name; ?>', '<?php echo $email; ?>', '<?php echo $company; ?>');">Book Freight</div>
|
615 |
+
<div style="display: none; float: right; height: 35px; margin-top: 22px;" class="pls-wait<?php echo $or_id; ?>">
|
616 |
+
|
617 |
+
|
618 |
+
|
619 |
+
<span id="loader_loctype<?php echo $or_id; ?>">
|
620 |
+
<img class="v-middle" title="Loading Booking..." alt="Loading carrier rates..." src="http://staging.brstdev.com/magento/skin/frontend/default/default/images/opc-ajax-loader.gif">
|
621 |
+
</span>
|
622 |
+
</div>
|
623 |
+
</div>
|
624 |
+
</div>
|
625 |
+
|
626 |
+
<?php }
|
627 |
+
}
|
628 |
+
}
|
629 |
+
|
630 |
+
}
|
631 |
+
|
632 |
+
}
|
633 |
+
}
|
634 |
+
|
635 |
+
|
636 |
+
?> <div style="width:600px; float:left; margin-top: 5px; display:none;" id="<?php echo $or_id; ?>">
|
637 |
+
<div style="width: 550px; background: none repeat scroll 0% 0% rgb(111, 137, 146); text-align: left; padding: 1px 0px 1px 1px; height: 21px; border: 1px solid rgb(251, 145, 62);">
|
638 |
+
<h4 style="color:white;">Book Order On Freight</h4>
|
639 |
+
</div>
|
640 |
+
<div style="width: 550px; border: 1px solid rgb(214, 214, 214); background: none repeat scroll 0% 0% rgb(250, 250, 250);float: left;" class="admin_view">
|
641 |
+
<div style="float: left; width: 310px;">
|
642 |
+
<!--<div>Name: <?php //echo $item->getName(); ?></div>
|
643 |
+
<div>Product ID: <?php //echo $or_id;?></div>
|
644 |
+
<div>Product SKU: <?php //echo $product_sku;?></div>
|
645 |
+
<div>Product Price: <?php //echo $product_price;?></div> -->
|
646 |
+
<div>Product WareHouse: <?php echo $ware_result['cmpny_name'];?></div>
|
647 |
+
<div>Origin Location Type: <?php echo $ware_result['location_type'];?></div>
|
648 |
+
<div>Destination Location Type: <?php echo $final_dest;?></div>
|
649 |
+
<div>Carrier: <?php echo $carrier_name;?></div>
|
650 |
+
<?php $warehouse_location_type = str_replace(' ', '', $ware_result['location_type']); ?>
|
651 |
+
<div>WareHouse PostCode: <?php echo $ware_result['cmpny_postcode'];?></div>
|
652 |
+
<div>Shipping Charges: <?php echo $result_ship['shipping_charge'];?></div>
|
653 |
+
</div>
|
654 |
+
<div style="float: right; width: 210px; display:none;" id="get_rate_ajax">
|
655 |
+
|
656 |
+
|
657 |
+
|
658 |
+
</div>
|
659 |
+
<?php if($bookingno > 0){
|
660 |
+
?>
|
661 |
+
<div class="ajax-result" style="" id="ajax_result<?php print $id; ?>">
|
662 |
+
<h4><?php echo $status; ?></h4>
|
663 |
+
<h4>Booking Id: <?php echo $bookingno; ?></h4>
|
664 |
+
|
665 |
+
<span>Date Between:
|
666 |
+
<label for="from">From</label>
|
667 |
+
<span><?php echo $date_from; ?></span>
|
668 |
+
<label for="to">To</label>
|
669 |
+
<span><?php echo $date_to; ?></span>
|
670 |
+
</div>
|
671 |
+
</span>
|
672 |
+
|
673 |
+
</div>
|
674 |
+
<?php } else{ ?>
|
675 |
+
<div id = "ajax_call<?php echo $or_id; ?>" style=" background-color: hsl(26, 88%, 46%); border: 1px solid hsl(17, 100%, 27%); border-radius: 5px; float: right; margin-right: 20px; margin-top: 20px; padding: 2px; text-align: center; width: 100px; color: hsl(0, 0%, 100%); cursor:pointer" onclick="AdminGetRate('<?php echo $ware_first_name; ?>','<?php echo $ware_last_name; ?>','<?php echo $ware_phone; ?>','<?php echo $ware_cmpny_postcode; ?>','<?php echo $ware_street; ?>','<?php echo $ware_city; ?>','<?php echo $ware_state; ?>','<?php echo $ware_country_id; ?>','<?php echo $firstname; ?>','<?php echo $lastname; ?>', '<?php echo $telephone; ?>', '<?php echo $pincode; ?>', '<?php echo $street; ?>', '<?php echo $city;?>', '<?php echo $region; ?>', '<?php echo $country_id; ?>', '<?php echo $quote_id; ?>');">GetNewRates</div>
|
676 |
+
<div style="display: none; float: right; height: 35px; margin-right: 10px; margin-top: 22px;" class="pls-wait<?php echo $or_id; ?>">
|
677 |
+
|
678 |
+
|
679 |
+
<input type="hidden" value = "<?php echo $or_id; ?>" id="product_id"/>
|
680 |
+
<span id="loader_loctype<?php echo $or_id; ?>">
|
681 |
+
<img class="v-middle" title="Loading Booking..." alt="Loading carrier rates..." src="http://staging.brstdev.com/magento/skin/frontend/default/default/images/opc-ajax-loader.gif">
|
682 |
+
</span>
|
683 |
+
</div>
|
684 |
+
|
685 |
+
<span>Date Select:
|
686 |
+
<label for="from">From</label>
|
687 |
+
<input type="text" id="from" name="from">
|
688 |
+
<label for="to">To</label>
|
689 |
+
<input type="text" id="to" name="to">
|
690 |
+
|
691 |
+
</span>
|
692 |
+
|
693 |
+
|
694 |
+
</div>
|
695 |
+
<?php } ?>
|
696 |
+
|
697 |
+
<?php
|
698 |
+
|
699 |
+
?>
|
700 |
+
|
701 |
+
<script type="text/javascript">
|
702 |
+
|
703 |
+
jQuery.noConflict();
|
704 |
+
function ajaxcallnewfrieght( id, pr, qote, order_id, grand, proprice)
|
705 |
+
{
|
706 |
+
//alert(pr);
|
707 |
+
//alert(id);
|
708 |
+
ajaxresponse = false;
|
709 |
+
var valMy = pr;
|
710 |
+
var di = id;
|
711 |
+
var quote = qote;
|
712 |
+
var order_id = order_id;
|
713 |
+
var grandtotal = grand;
|
714 |
+
var product_price = proprice;
|
715 |
+
|
716 |
+
parameters={ diq:di, val:valMy, qtid:quote, order_id:order_id, grandtotal:grandtotal, product_price:product_price };
|
717 |
+
var url = '<?php echo $this->getUrl('freight/index/save'); ?>';
|
718 |
+
new Ajax.Request(url,{
|
719 |
+
parameters:parameters,
|
720 |
+
onComplete: function (transport){
|
721 |
+
|
722 |
+
//var response = transport.responseText.evalJSON();
|
723 |
+
// alert(response);
|
724 |
+
}
|
725 |
+
});
|
726 |
+
|
727 |
+
}
|
728 |
+
function AdminGetRate(ware_fname, ware_lname, warephone, warepostcode, warestreet, warecity, warestate, warecountry, fname, lname, telephone, pincode, street, city, region, country, quote_id, hidden_id, rateid, warehousename, hour, ware_email, ware_comp_name, email, company)
|
729 |
+
{
|
730 |
+
|
731 |
+
/* alert(url+','+product_id+','+des+','+nmfc+','+flen+','+fwidth+','+fheight+','+fclass+','+warecode+','+wareloctype) */
|
732 |
+
var agent = jQuery("#agent").val();
|
733 |
+
|
734 |
+
var product_id = jQuery("#product_id").val();
|
735 |
+
//var hidden_id = jQuery("#hidden_id").val();
|
736 |
+
//alert("#from"+hidden_id);
|
737 |
+
var url = jQuery("#url_api").val();
|
738 |
+
var from = jQuery("#from"+hidden_id).val();
|
739 |
+
//alert(from);
|
740 |
+
var arr = from.split('/');
|
741 |
+
var date_from = arr[2] + "-"+ arr[0]+"-"+arr[1];
|
742 |
+
var to = jQuery("#to"+hidden_id).val();
|
743 |
+
var arr = to.split('/');
|
744 |
+
var date_to = arr[2] + "-"+ arr[0]+"-"+arr[1];
|
745 |
+
if(from == '' ){
|
746 |
+
alert('Please Enter the date');
|
747 |
+
return false;
|
748 |
+
}
|
749 |
+
if(jQuery("#accept_term"+hidden_id).prop('checked') == false){
|
750 |
+
alert("Please Accept the Terms and Conditions");
|
751 |
+
return false;
|
752 |
+
}
|
753 |
+
jQuery('.pls-wait'+hidden_id).show();
|
754 |
+
jQuery.ajax({
|
755 |
+
type:'get',
|
756 |
+
url: url+'api_check.php',
|
757 |
+
dataType: "html",
|
758 |
+
data: {'date_from':date_from, 'date_to':date_to, 'ware_fname':ware_fname, 'ware_lname':ware_lname, 'warephone':warephone, 'warepostcode':warepostcode, 'warestreet':warestreet, 'warecity':warecity, 'warestate':warestate, 'warecountry':warecountry, 'fname':fname, 'lname':lname, 'telephone':telephone, 'pincode':pincode, 'street':street, 'city':city, 'region':region, 'country':country, 'quote_id':quote_id, 'product_id':hidden_id, 'rateid':rateid, 'agent':agent, 'hour':hour, 'ware_email':ware_email, 'ware_comp_name':ware_comp_name, 'email':email, 'company':company},
|
759 |
+
success:function(value) {
|
760 |
+
//alert(value);
|
761 |
+
var value = value.trim();
|
762 |
+
//var value = jQuery.isNumeric(value);
|
763 |
+
if(jQuery.isNumeric(value)){
|
764 |
+
BOLcheck(value, hidden_id);
|
765 |
+
//return BOLcheck(value);
|
766 |
+
|
767 |
+
jQuery('.pls-wait'+hidden_id).hide();
|
768 |
+
jQuery('#ajax_call'+hidden_id).hide();
|
769 |
+
jQuery('#accept'+hidden_id).hide();
|
770 |
+
//jQuery('#get_rate_ajax'+hidden_id).show();
|
771 |
+
jQuery( "#append_w" ).remove();
|
772 |
+
jQuery('<span>')
|
773 |
+
.attr('id', 'append_w')
|
774 |
+
.append(warehousename)
|
775 |
+
.appendTo('#append_ware')
|
776 |
+
jQuery('.messages').show();
|
777 |
+
jQuery('#ship_cancel_new'+hidden_id).show();
|
778 |
+
document.getElementById('get_rate_ajax'+hidden_id).innerHTML=value;
|
779 |
+
/* setTimeout(function(){
|
780 |
+
window.location.reload(1);
|
781 |
+
}, 3000); */
|
782 |
+
|
783 |
+
//alert(value);
|
784 |
+
jQuery('<div>')
|
785 |
+
.attr('id','removable_app')
|
786 |
+
.attr('class','new_class')
|
787 |
+
.attr('onclick','cancel_api(\''+value+'\',\''+warehousename+'\',\''+hidden_id+'\',\''+quote_id+'\')')
|
788 |
+
.append('Cancel Booking')
|
789 |
+
.appendTo('#ship_cancel_new'+hidden_id)
|
790 |
+
|
791 |
+
jQuery('<span>')
|
792 |
+
.append(' Quote ID:' +value+' - Booked')
|
793 |
+
.appendTo('#quote'+hidden_id)
|
794 |
+
|
795 |
+
jQuery('.messages_error').hide();
|
796 |
+
jQuery('.messages_ship').hide();
|
797 |
+
jQuery('.messages_ship_error').hide();
|
798 |
+
|
799 |
+
|
800 |
+
}
|
801 |
+
else{
|
802 |
+
jQuery('.pls-wait'+hidden_id).hide();
|
803 |
+
jQuery( "#append_w_error" ).remove();
|
804 |
+
jQuery('<span>')
|
805 |
+
.attr('id', 'append_w_error')
|
806 |
+
.append(warehousename+':'+value)
|
807 |
+
.appendTo('#append_ware_error')
|
808 |
+
jQuery('.messages_error').show();
|
809 |
+
jQuery('.messages_ship').hide();
|
810 |
+
jQuery('.messages').hide();
|
811 |
+
jQuery('.messages_ship_error').hide();
|
812 |
+
|
813 |
+
}
|
814 |
+
}
|
815 |
+
});
|
816 |
+
|
817 |
+
|
818 |
+
}
|
819 |
+
function BOLcheck(value, hidden_id){
|
820 |
+
//alert(value);
|
821 |
+
var url = jQuery("#url_api").val();
|
822 |
+
var sand = jQuery("#sand").val();
|
823 |
+
if(sand == '1'){
|
824 |
+
sand = 'https://sandbox.freightcenter.com/DownloadBol.aspx?qid='+value;
|
825 |
+
}
|
826 |
+
else{
|
827 |
+
sand = 'https://www.freightcenter.com/DownloadBol.aspx?qid='+value;
|
828 |
+
}
|
829 |
+
jQuery.ajax({
|
830 |
+
|
831 |
+
type:'get',
|
832 |
+
url: url+'BOLCheck.php',
|
833 |
+
dataType: "html",
|
834 |
+
data: {'bookingno':value},
|
835 |
+
success:function(value) {
|
836 |
+
var value = value.trim();
|
837 |
+
if(value == 'true'){
|
838 |
+
jQuery('.new_class_bol').hide();
|
839 |
+
jQuery('#withBol'+hidden_id).hide();
|
840 |
+
//alert('hide');
|
841 |
+
jQuery('.new_class_bol').show();
|
842 |
+
//alert('show');
|
843 |
+
jQuery('<div>')
|
844 |
+
.attr('id','removabl')
|
845 |
+
.append(
|
846 |
+
jQuery('<a>')
|
847 |
+
.attr('href',sand)
|
848 |
+
.attr('target', '_blank')
|
849 |
+
.attr('class','new_class_bol')
|
850 |
+
.append('Download BOL')
|
851 |
+
)
|
852 |
+
.appendTo('#ship_cancel_new'+hidden_id)
|
853 |
+
jQuery('#withBol'+hidden_id).show();
|
854 |
+
|
855 |
+
}
|
856 |
+
else{
|
857 |
+
jQuery('.new_class_bol').hide();
|
858 |
+
jQuery('#withBol'+hidden_id).hide();
|
859 |
+
|
860 |
+
}
|
861 |
+
}
|
862 |
+
});
|
863 |
+
|
864 |
+
}
|
865 |
+
|
866 |
+
function BOLcheck_first(value, hidden_id){
|
867 |
+
//alert(value);
|
868 |
+
var url = jQuery("#url_api").val();
|
869 |
+
jQuery.ajax({
|
870 |
+
|
871 |
+
type:'get',
|
872 |
+
url: url+'BOLCheck.php',
|
873 |
+
dataType: "html",
|
874 |
+
data: {'bookingno':value},
|
875 |
+
success:function(value) {
|
876 |
+
var value = value.trim();
|
877 |
+
//alert(value);
|
878 |
+
if(value == 'true'){
|
879 |
+
jQuery('.new_class_bol').show();
|
880 |
+
//alert('show');
|
881 |
+
jQuery('#withBol'+hidden_id).show();
|
882 |
+
|
883 |
+
//alert('hide');
|
884 |
+
|
885 |
+
}
|
886 |
+
else{
|
887 |
+
jQuery('#withBol'+hidden_id).hide();
|
888 |
+
|
889 |
+
}
|
890 |
+
}
|
891 |
+
});
|
892 |
+
|
893 |
+
}
|
894 |
+
|
895 |
+
function JQueryConfirm(){
|
896 |
+
|
897 |
+
|
898 |
+
var msg = 'Confirmation Msg.';
|
899 |
+
var div = jQuery("<div>" + msg + "</div>");
|
900 |
+
div.dialog({
|
901 |
+
title: "Confirm",
|
902 |
+
buttons: [
|
903 |
+
{
|
904 |
+
text: "Yes",
|
905 |
+
click: function () {
|
906 |
+
alert('yeah');
|
907 |
+
}
|
908 |
+
},
|
909 |
+
{
|
910 |
+
text: "No",
|
911 |
+
click: function () {
|
912 |
+
div.dialog("close");
|
913 |
+
}
|
914 |
+
}
|
915 |
+
]
|
916 |
+
});
|
917 |
+
|
918 |
+
}
|
919 |
+
function cancel_api(bookingno, warehousename, product_id, quote_id){
|
920 |
+
var url = jQuery("#url_api").val();
|
921 |
+
var agent = jQuery("#agent").val();
|
922 |
+
|
923 |
+
var msg = 'Are you sure you want to cancel this shipment?';
|
924 |
+
var div = jQuery("<div>" + msg + "</div>");
|
925 |
+
div.dialog({
|
926 |
+
title: "Confirm",
|
927 |
+
buttons: [
|
928 |
+
{
|
929 |
+
|
930 |
+
|
931 |
+
text: "Yes",
|
932 |
+
click: function () {
|
933 |
+
div.dialog("close");
|
934 |
+
jQuery('.pls-wait'+product_id).show();
|
935 |
+
jQuery.ajax({
|
936 |
+
|
937 |
+
type:'get',
|
938 |
+
url: url+'api_cancel.php',
|
939 |
+
dataType: "html",
|
940 |
+
data: {'bookingno':bookingno, 'product_id':product_id, 'quote_id':quote_id, 'agent':agent},
|
941 |
+
success:function(value) {
|
942 |
+
var value = value.trim();
|
943 |
+
if(value == 'SUCCESS'){
|
944 |
+
jQuery('#ship_cancel'+product_id).hide();
|
945 |
+
jQuery('.pls-wait'+product_id).hide();
|
946 |
+
jQuery('#quote'+product_id).hide();
|
947 |
+
jQuery( "#append_w_ship" ).remove();
|
948 |
+
jQuery('<span>')
|
949 |
+
.attr('id', 'append_w_ship')
|
950 |
+
.append(warehousename)
|
951 |
+
.appendTo('#append_ware_ship')
|
952 |
+
jQuery('.messages_ship').show();
|
953 |
+
jQuery('.messages').hide();
|
954 |
+
jQuery('.messages_error').hide();
|
955 |
+
// document.getElementById('get_rate_ajax'+hidden_id).innerHTML=value;
|
956 |
+
// location.reload();
|
957 |
+
|
958 |
+
//alert(value);
|
959 |
+
|
960 |
+
jQuery('.messages_ship_error').hide();
|
961 |
+
jQuery('#ship_cancel_new'+product_id).hide();
|
962 |
+
}
|
963 |
+
else if(value == 'WARNING'){
|
964 |
+
jQuery('#ship_cancel'+product_id).hide();
|
965 |
+
jQuery('.pls-wait'+product_id).hide();
|
966 |
+
jQuery('#quote'+product_id).hide();
|
967 |
+
jQuery( "#append_w_ship_w" ).remove();
|
968 |
+
jQuery('<span>')
|
969 |
+
.attr('id', 'append_w_ship_w')
|
970 |
+
.append("Thank you for submitting your request for shipment "+bookingno+". We are now reviewing your information and will back to you shortly with additional details.If you have any further questions, please contact our customer service department at 800-716-7608 ext 1084")
|
971 |
+
.appendTo('#append_ware_ship_w')
|
972 |
+
jQuery('.messages_ship_w').show();
|
973 |
+
jQuery('.messages').hide();
|
974 |
+
jQuery('.messages_error').hide();
|
975 |
+
// document.getElementById('get_rate_ajax'+hidden_id).innerHTML=value;
|
976 |
+
// location.reload();
|
977 |
+
|
978 |
+
//alert(value);
|
979 |
+
|
980 |
+
jQuery('.messages_ship_error').hide();
|
981 |
+
jQuery('#ship_cancel_new'+product_id).hide();
|
982 |
+
|
983 |
+
}
|
984 |
+
else{
|
985 |
+
jQuery('.pls-wait'+product_id).hide();
|
986 |
+
jQuery( "#append_w_ship_error" ).remove();
|
987 |
+
jQuery('<span>')
|
988 |
+
.attr('id', 'append_w_ship_error')
|
989 |
+
.append(warehousename+':'+value)
|
990 |
+
.appendTo('#append_ware_ship_error')
|
991 |
+
jQuery('.messages_ship_error').show();
|
992 |
+
jQuery('.messages_ship').hide();
|
993 |
+
jQuery('.messages').hide();
|
994 |
+
jQuery('.messages_error').hide();
|
995 |
+
}
|
996 |
+
}
|
997 |
+
});
|
998 |
+
}
|
999 |
+
},
|
1000 |
+
{
|
1001 |
+
text: "No",
|
1002 |
+
click: function () {
|
1003 |
+
div.dialog("close");
|
1004 |
+
}
|
1005 |
+
}
|
1006 |
+
]
|
1007 |
+
});
|
1008 |
+
|
1009 |
+
/* jQuery.ajax({
|
1010 |
+
type:'get',
|
1011 |
+
url: url+'api_cancel.php',
|
1012 |
+
dataType: "html",
|
1013 |
+
data: {'bookingno':bookingno, 'product_id':product_id, 'quote_id':quote_id},
|
1014 |
+
success:function(value) {
|
1015 |
+
if(value = 'SUCCESS'){
|
1016 |
+
jQuery('#ship_cancel'+product_id).hide();
|
1017 |
+
jQuery('.pls-wait'+product_id).hide();
|
1018 |
+
jQuery('#quote'+product_id).hide();
|
1019 |
+
jQuery( "#append_w_ship" ).remove();
|
1020 |
+
jQuery('<span>')
|
1021 |
+
.attr('id', 'append_w_ship')
|
1022 |
+
.append(warehousename)
|
1023 |
+
.appendTo('#append_ware_ship')
|
1024 |
+
jQuery('.messages_ship').show();
|
1025 |
+
// document.getElementById('get_rate_ajax'+hidden_id).innerHTML=value;
|
1026 |
+
// location.reload();
|
1027 |
+
|
1028 |
+
//alert(value);
|
1029 |
+
}
|
1030 |
+
else{
|
1031 |
+
jQuery( "#append_w_ship_error" ).remove();
|
1032 |
+
jQuery('<span>')
|
1033 |
+
.attr('id', 'append_w_ship_error')
|
1034 |
+
.append(warehousename)
|
1035 |
+
.appendTo('#append_ware_ship_error')
|
1036 |
+
jQuery('.messages_ship_error').show();
|
1037 |
+
}
|
1038 |
+
}
|
1039 |
+
});
|
1040 |
+
*/
|
1041 |
+
|
1042 |
+
}
|
1043 |
+
jQuery(function() {
|
1044 |
+
|
1045 |
+
jQuery( ".from" ).datepicker({
|
1046 |
+
minDate: 0 ,
|
1047 |
+
defaultDate: "+1w",
|
1048 |
+
changeMonth: true,
|
1049 |
+
numberOfMonths: 1,
|
1050 |
+
onClose: function( selectedDate ) {
|
1051 |
+
jQuery( ".to" ).datepicker( "option", "minDate", selectedDate );
|
1052 |
+
}
|
1053 |
+
});
|
1054 |
+
|
1055 |
+
jQuery( ".to" ).datepicker({
|
1056 |
+
defaultDate: "+1w",
|
1057 |
+
changeMonth: true,
|
1058 |
+
numberOfMonths: 1,
|
1059 |
+
onClose: function( selectedDate ) {
|
1060 |
+
jQuery( ".from" ).datepicker( "option", "maxDate", selectedDate );
|
1061 |
+
}
|
1062 |
+
});
|
1063 |
+
});
|
1064 |
+
|
1065 |
+
|
1066 |
+
</script>
|
1067 |
+
|
1068 |
+
|
app/design/adminhtml/default/default/template/freightcenter_ship/system/config/cdisplay.phtml
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<select class=" select" name="<?php echo $this->getNamePrefix() ?>" id="carriers_excellence_carrier_display">
|
2 |
+
<?php foreach ($this->getValues() as $name => $label): ?>
|
3 |
+
<option value="<?php echo $name ?>" <?php if($this->getIsChecked() == $name) { echo 'selected="selected"'; } ?>><?php echo $name ?></option>
|
4 |
+
<?php endforeach; ?>
|
5 |
+
</select>
|
app/design/adminhtml/default/default/template/freightcenter_ship/system/config/destloctype.phtml
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<input type="hidden" name="<?php echo $this->getNamePrefix() ?>" value="" /><!-- this is send if nothing is checked -->
|
2 |
+
<ul class="checkboxes">
|
3 |
+
<?php foreach ($this->getValues() as $name => $label): ?>
|
4 |
+
<li>
|
5 |
+
<input type="checkbox" value="<?php echo $name?>" name="<?php echo $this->getNamePrefix() ?>[]" id="<?php echo $this->getHtmlId() . '_' . $name ?>"<?php echo ($this->getIsChecked($name) ? ' checked="checked"' : '') ?>/><label for="<?php echo $this->getHtmlId() . '_' . $name ?>">
|
6 |
+
<?php echo $label ?>
|
7 |
+
</label>
|
8 |
+
</li>
|
9 |
+
<?php endforeach;?>
|
10 |
+
</ul>
|
app/design/adminhtml/default/default/template/freightcenter_ship/system/config/positions.phtml
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
<input type="button" onclick="check();" id="button_check" value=" Select All Carriers" />
|
3 |
+
<input type="hidden" name="<?php echo $this->getNamePrefix() ?>" value="" /><!-- this is send if nothing is checked -->
|
4 |
+
<ul class="checkboxes">
|
5 |
+
<?php foreach ($this->getValues() as $name => $label): ?>
|
6 |
+
<li>
|
7 |
+
<input type="checkbox" value="<?php echo $name?>" name="<?php echo $this->getNamePrefix() ?>[]" id="<?php echo $this->getHtmlId() . '_' . $name ?>"<?php echo ($this->getIsChecked($name) ? ' checked="checked"' : '') ?>/><label for="<?php echo $this->getHtmlId() . '_' . $name ?>">
|
8 |
+
<?php echo $label ?>
|
9 |
+
</label>
|
10 |
+
</li>
|
11 |
+
<?php endforeach;?>
|
12 |
+
</ul>
|
13 |
+
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
|
14 |
+
<script type="text/javascript">
|
15 |
+
jQuery.noConflict();
|
16 |
+
//function check(){
|
17 |
+
jQuery("#button_check").click(function(){
|
18 |
+
jQuery("#row_carriers_freightcenter_positions input[type=checkbox]").attr('checked', true);
|
19 |
+
//});
|
20 |
+
/* jQuery("#button_uncheck").click(function(){
|
21 |
+
jQuery("#row_carriers_freightcenter_positions input[type=checkbox]").prop('checked', false);
|
22 |
+
}); */
|
23 |
+
});
|
24 |
+
</script>
|
app/design/adminhtml/default/default/template/sales/order/view/items.phtml
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package default_default
|
23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php $_order = $this->getOrder() ?>
|
28 |
+
<div class="grid np">
|
29 |
+
<div class="hor-scroll">
|
30 |
+
<table cellspacing="0" class="data order-tables">
|
31 |
+
<col />
|
32 |
+
<col width="1" />
|
33 |
+
<col width="1" />
|
34 |
+
<col width="1" />
|
35 |
+
<col width="1" />
|
36 |
+
<col width="1" />
|
37 |
+
<col width="1" />
|
38 |
+
<col width="1" />
|
39 |
+
<col width="1" />
|
40 |
+
<col width="1" />
|
41 |
+
<thead>
|
42 |
+
<tr class="headings">
|
43 |
+
<th><?php echo $this->helper('sales')->__('Product') ?></th>
|
44 |
+
<th><span class="nobr"><?php echo $this->helper('sales')->__('Item Status') ?></span></th>
|
45 |
+
<th><span class="nobr"><?php echo $this->helper('sales')->__('Original Price') ?></span></th>
|
46 |
+
<th><?php echo $this->helper('sales')->__('Price') ?></th>
|
47 |
+
<th class="a-center"><?php echo $this->helper('sales')->__('Qty') ?></th>
|
48 |
+
<th><?php echo $this->helper('sales')->__('Subtotal') ?></th>
|
49 |
+
<th><span class="nobr"><?php echo $this->helper('sales')->__('Tax Amount') ?></span></th>
|
50 |
+
<th><span class="nobr"><?php echo $this->helper('sales')->__('Tax Percent') ?></span></th>
|
51 |
+
<th><span class="nobr"><?php echo $this->helper('sales')->__('Discount Amount') ?></span></th>
|
52 |
+
<th class="last"><span class="nobr"><?php echo $this->helper('sales')->__('Row Total') ?></span></th>
|
53 |
+
<th><span class="nobr"><?php echo $this->helper('sales')->__('Warehouse') ?></span></th>
|
54 |
+
</tr>
|
55 |
+
</thead>
|
56 |
+
<?php $_items = $this->getItemsCollection() ?>
|
57 |
+
<?php $i=0;foreach ($_items as $_item):?>
|
58 |
+
<?php if ($_item->getParentItem()) continue; else $i++;?>
|
59 |
+
<tbody class="<?php echo $i%2?'even':'odd' ?>">
|
60 |
+
<?php echo $this->getItemHtml($_item) ?>
|
61 |
+
<?php echo $this->getItemExtraInfoHtml($_item) ?>
|
62 |
+
</tbody>
|
63 |
+
<?php endforeach; ?>
|
64 |
+
</table>
|
65 |
+
</div>
|
66 |
+
</div>
|
67 |
+
<br />
|
app/design/adminhtml/default/default/template/sales/order/view/items/renderer/default.phtml
ADDED
@@ -0,0 +1,277 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package default_default
|
23 |
+
* @copyright Copyright (c) 2013 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
|
28 |
+
|
29 |
+
|
30 |
+
|
31 |
+
|
32 |
+
|
33 |
+
?>
|
34 |
+
<?php $_item = $this->getItem() ?>
|
35 |
+
<?php $this->setPriceDataObject($_item) ?>
|
36 |
+
<tr<?php if (!$this->canDisplayGiftmessage()): ?> class="border"<?php endif; ?>>
|
37 |
+
<td>
|
38 |
+
<?php if ($this->canDisplayContainer()): ?>
|
39 |
+
<div id="<?php echo $this->getHtmlId() ?>" class="item-container">
|
40 |
+
<?php endif; ?>
|
41 |
+
<div class="item-text">
|
42 |
+
<?php echo $this->getColumnHtml($_item, 'name') ?>
|
43 |
+
<?php //echo $_item->getId() ?>
|
44 |
+
</div>
|
45 |
+
<?php if ($this->canDisplayContainer()): ?>
|
46 |
+
</div>
|
47 |
+
<?php endif ?>
|
48 |
+
</td>
|
49 |
+
|
50 |
+
<td class="a-center"><?php echo $_item->getStatus() ?></td>
|
51 |
+
<td class="a-right"><?php echo $this->displayPriceAttribute('original_price') ?></td>
|
52 |
+
<td class="a-right">
|
53 |
+
<?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
|
54 |
+
<span class="price-excl-tax">
|
55 |
+
<?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
|
56 |
+
<span class="label"><?php echo $this->__('Excl. Tax'); ?>:</span>
|
57 |
+
<?php endif; ?>
|
58 |
+
|
59 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales', $_item->getStoreId())): ?>
|
60 |
+
<?php
|
61 |
+
echo $this->displayPrices(
|
62 |
+
$_item->getBasePrice()+$_item->getBaseWeeeTaxAppliedAmount()+$_item->getBaseWeeeTaxDisposition(),
|
63 |
+
$_item->getPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()
|
64 |
+
);
|
65 |
+
?>
|
66 |
+
<?php else: ?>
|
67 |
+
<?php echo $this->displayPrices($_item->getBasePrice(), $_item->getPrice()) ?>
|
68 |
+
<?php endif; ?>
|
69 |
+
|
70 |
+
|
71 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
72 |
+
<br />
|
73 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales', $_item->getStoreId())): ?>
|
74 |
+
<small>
|
75 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
76 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->displayPrices($tax['base_amount'], $tax['amount']); ?></span>
|
77 |
+
<?php endforeach; ?>
|
78 |
+
</small>
|
79 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales', $_item->getStoreId())): ?>
|
80 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
81 |
+
<span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $this->displayPrices($tax['base_amount'], $tax['amount']); ?></small></span>
|
82 |
+
<?php endforeach; ?>
|
83 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales', $_item->getStoreId())): ?>
|
84 |
+
<small>
|
85 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
86 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->displayPrices($tax['base_amount'], $tax['amount']); ?></span>
|
87 |
+
<?php endforeach; ?>
|
88 |
+
</small>
|
89 |
+
<?php endif; ?>
|
90 |
+
|
91 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales', $_item->getStoreId())): ?>
|
92 |
+
<br />
|
93 |
+
<span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br />
|
94 |
+
<?php
|
95 |
+
echo $this->displayPrices(
|
96 |
+
$_item->getBasePrice()+$_item->getBaseWeeeTaxAppliedAmount()+$_item->getBaseWeeeTaxDisposition(),
|
97 |
+
$_item->getPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()
|
98 |
+
);
|
99 |
+
?>
|
100 |
+
</span>
|
101 |
+
<?php endif; ?>
|
102 |
+
<?php endif; ?>
|
103 |
+
</span>
|
104 |
+
<br />
|
105 |
+
<?php endif; ?>
|
106 |
+
<?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
|
107 |
+
<span class="price-incl-tax">
|
108 |
+
<?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
|
109 |
+
<span class="label"><?php echo $this->__('Incl. Tax'); ?>:</span>
|
110 |
+
<?php endif; ?>
|
111 |
+
<?php $_incl = $this->helper('checkout')->getPriceInclTax($_item); ?>
|
112 |
+
<?php $_baseIncl = $this->helper('checkout')->getBasePriceInclTax($_item); ?>
|
113 |
+
|
114 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales', $_item->getStoreId())): ?>
|
115 |
+
<?php echo $this->displayPrices($_baseIncl + Mage::helper('weee')->getBaseWeeeTaxInclTax($_item), $_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?>
|
116 |
+
<?php else: ?>
|
117 |
+
<?php echo $this->displayPrices($_baseIncl-$_item->getBaseWeeeTaxDisposition(), $_incl-$_item->getWeeeTaxDisposition()) ?>
|
118 |
+
<?php endif; ?>
|
119 |
+
|
120 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
121 |
+
<br />
|
122 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales', $_item->getStoreId())): ?>
|
123 |
+
<small>
|
124 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
125 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->displayPrices($tax['base_amount_incl_tax'], $tax['amount_incl_tax']); ?></span>
|
126 |
+
<?php endforeach; ?>
|
127 |
+
</small>
|
128 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales', $_item->getStoreId())): ?>
|
129 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
130 |
+
<span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $this->displayPrices($tax['base_amount_incl_tax'], $tax['amount_incl_tax']); ?></small></span>
|
131 |
+
<?php endforeach; ?>
|
132 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales', $_item->getStoreId())): ?>
|
133 |
+
<small>
|
134 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
135 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->displayPrices($tax['base_amount_incl_tax'], $tax['amount_incl_tax']); ?></span>
|
136 |
+
<?php endforeach; ?>
|
137 |
+
</small>
|
138 |
+
<?php endif; ?>
|
139 |
+
|
140 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales', $_item->getStoreId())): ?>
|
141 |
+
<br />
|
142 |
+
<span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $this->displayPrices($_baseIncl + Mage::helper('weee')->getBaseWeeeTaxInclTax($_item) , $_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?></span>
|
143 |
+
<?php endif; ?>
|
144 |
+
<?php endif; ?>
|
145 |
+
</span>
|
146 |
+
<?php endif; ?>
|
147 |
+
|
148 |
+
</td>
|
149 |
+
<td><?php echo $this->getColumnHtml($_item, 'qty') ?></td>
|
150 |
+
|
151 |
+
<td class="a-right">
|
152 |
+
<?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
|
153 |
+
<span class="price-excl-tax">
|
154 |
+
<?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
|
155 |
+
<span class="label"><?php echo $this->__('Excl. Tax'); ?>:</span>
|
156 |
+
<?php endif; ?>
|
157 |
+
|
158 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales', $_item->getStoreId())): ?>
|
159 |
+
<?php
|
160 |
+
echo $this->displayPrices(
|
161 |
+
$_item->getBaseRowTotal()+$_item->getBaseWeeeTaxAppliedRowAmount()+$_item->getBaseWeeeTaxRowDisposition(),
|
162 |
+
$_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()
|
163 |
+
);
|
164 |
+
?>
|
165 |
+
<?php else: ?>
|
166 |
+
<?php echo $this->displayPrices($_item->getBaseRowTotal(), $_item->getRowTotal()) ?>
|
167 |
+
<?php endif; ?>
|
168 |
+
|
169 |
+
|
170 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
171 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales', $_item->getStoreId())): ?>
|
172 |
+
<small>
|
173 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
174 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->displayPrices($tax['base_row_amount'], $tax['row_amount']); ?></span>
|
175 |
+
<?php endforeach; ?>
|
176 |
+
</small>
|
177 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales', $_item->getStoreId())): ?>
|
178 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
179 |
+
<span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $this->displayPrices($tax['base_row_amount'], $tax['row_amount']); ?></small></span>
|
180 |
+
<?php endforeach; ?>
|
181 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales', $_item->getStoreId())): ?>
|
182 |
+
<small>
|
183 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
184 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->displayPrices($tax['base_row_amount'], $tax['row_amount']); ?></span>
|
185 |
+
<?php endforeach; ?>
|
186 |
+
</small>
|
187 |
+
<?php endif; ?>
|
188 |
+
|
189 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales', $_item->getStoreId())): ?>
|
190 |
+
<br />
|
191 |
+
<span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br />
|
192 |
+
<?php
|
193 |
+
echo $this->displayPrices(
|
194 |
+
$_item->getBaseRowTotal()+$_item->getBaseWeeeTaxAppliedRowAmount()+$_item->getBaseWeeeTaxRowDisposition(),
|
195 |
+
$_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()
|
196 |
+
);
|
197 |
+
?>
|
198 |
+
</span>
|
199 |
+
<?php endif; ?>
|
200 |
+
<?php endif; ?>
|
201 |
+
</span>
|
202 |
+
<br />
|
203 |
+
<?php endif; ?>
|
204 |
+
<?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
|
205 |
+
<span class="price-incl-tax">
|
206 |
+
<?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
|
207 |
+
<span class="label"><?php echo $this->__('Incl. Tax'); ?>:</span>
|
208 |
+
<?php endif; ?>
|
209 |
+
<?php $_incl = $this->helper('checkout')->getSubtotalInclTax($_item); ?>
|
210 |
+
<?php $_baseIncl = $this->helper('checkout')->getBaseSubtotalInclTax($_item); ?>
|
211 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales', $_item->getStoreId())): ?>
|
212 |
+
<?php echo $this->displayPrices($_baseIncl + Mage::helper('weee')->getBaseRowWeeeTaxInclTax($_item), $_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?>
|
213 |
+
<?php else: ?>
|
214 |
+
<?php echo $this->displayPrices($_baseIncl-$_item->getBaseWeeeTaxRowDisposition(), $_incl-$_item->getWeeeTaxRowDisposition()) ?>
|
215 |
+
<?php endif; ?>
|
216 |
+
|
217 |
+
|
218 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
219 |
+
|
220 |
+
<br />
|
221 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales', $_item->getStoreId())): ?>
|
222 |
+
<small>
|
223 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
224 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->displayPrices($tax['base_row_amount_incl_tax'], $tax['row_amount_incl_tax']); ?></span>
|
225 |
+
<?php endforeach; ?>
|
226 |
+
</small>
|
227 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales', $_item->getStoreId())): ?>
|
228 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
229 |
+
<span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $this->displayPrices($tax['base_row_amount_incl_tax'], $tax['row_amount_incl_tax']); ?></small></span>
|
230 |
+
<?php endforeach; ?>
|
231 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales', $_item->getStoreId())): ?>
|
232 |
+
<small>
|
233 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
234 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->displayPrices($tax['base_row_amount_incl_tax'], $tax['row_amount_incl_tax']); ?></span>
|
235 |
+
<?php endforeach; ?>
|
236 |
+
</small>
|
237 |
+
<?php endif; ?>
|
238 |
+
|
239 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales', $_item->getStoreId())): ?>
|
240 |
+
<br /><span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $this->displayPrices($_baseIncl + Mage::helper('weee')->getBaseRowWeeeTaxInclTax($_item),$_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?></span>
|
241 |
+
<?php endif; ?>
|
242 |
+
<?php endif; ?>
|
243 |
+
</span>
|
244 |
+
<?php endif; ?>
|
245 |
+
</td>
|
246 |
+
<td class="a-right"><?php echo $this->displayPriceAttribute('tax_amount') ?></td>
|
247 |
+
<td class="a-right"><?php echo $this->displayTaxPercent($_item) ?></td>
|
248 |
+
<td class="a-right"><?php echo $this->displayPriceAttribute('discount_amount') ?></td>
|
249 |
+
<td class="a-right last">
|
250 |
+
<?php echo $this->displayPrices(
|
251 |
+
$_item->getBaseRowTotal() + $_item->getBaseTaxAmount() + $_item->getBaseHiddenTaxAmount() + $_item->getBaseWeeeTaxAppliedRowAmount() - $_item->getBaseDiscountAmount(),
|
252 |
+
$_item->getRowTotal() + $_item->getTaxAmount() + $_item->getHiddenTaxAmount() + $_item->getWeeeTaxAppliedRowAmount() - $_item->getDiscountAmount()
|
253 |
+
); ?>
|
254 |
+
</td>
|
255 |
+
<td class="a-center" style="border-left: 1px solid rgb(213, 213, 213);">
|
256 |
+
<?php $sku = $_item->getSku();
|
257 |
+
$product_id = Mage::getModel('catalog/product')->getIdBySku($sku);
|
258 |
+
?>
|
259 |
+
<?php $product = Mage::getModel('catalog/product');
|
260 |
+
$product ->load($product_id);
|
261 |
+
$ware_name =array();
|
262 |
+
foreach($product as $frieght)
|
263 |
+
{
|
264 |
+
$attribute1 = Mage::getModel('eav/config')->getAttribute('catalog_product', 'origin_warehouse');
|
265 |
+
foreach ( $attribute1->getSource()->getAllOptions(true, true) as $opt_menu)
|
266 |
+
{
|
267 |
+
$m1_attribute[$opt_menu['value']] = $opt_menu['label'];
|
268 |
+
}
|
269 |
+
$ware_name[] = $m1_attribute[$frieght['origin_warehouse']];
|
270 |
+
}
|
271 |
+
$count = count(array_unique($ware_name));
|
272 |
+
if($count >1){
|
273 |
+
//foreach($ware_name as $key=>$val){ echo $count = count(array_unique($val));}
|
274 |
+
echo $ware_name[0];}else{ echo "Non Freight Product";}
|
275 |
+
?>
|
276 |
+
</td>
|
277 |
+
</tr>
|
app/design/frontend/base/default/layout/fee.xml
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<sales_order_view>
|
4 |
+
<reference name="order_totals">
|
5 |
+
<block type="fee/sales_order_total" name="fee.sales.order.total" />
|
6 |
+
</reference>
|
7 |
+
</sales_order_view>
|
8 |
+
<sales_order_print>
|
9 |
+
<reference name="order_totals">
|
10 |
+
<block type="fee/sales_order_total" name="fee.sales.order.total" />
|
11 |
+
</reference>
|
12 |
+
</sales_order_print>
|
13 |
+
<sales_email_order_items>
|
14 |
+
<reference name="order_totals">
|
15 |
+
<block type="fee/sales_order_total" name="fee.sales.order.total" />
|
16 |
+
</reference>
|
17 |
+
</sales_email_order_items>
|
18 |
+
|
19 |
+
<sales_order_invoice>
|
20 |
+
<reference name="invoice_totals">
|
21 |
+
<block type="fee/sales_order_total" name="fee.sales.order.total" />
|
22 |
+
</reference>
|
23 |
+
</sales_order_invoice>
|
24 |
+
<sales_order_printinvoice>
|
25 |
+
<reference name="invoice_totals">
|
26 |
+
<block type="fee/sales_order_total" name="fee.sales.order.total" />
|
27 |
+
</reference>
|
28 |
+
</sales_order_printinvoice>
|
29 |
+
<sales_email_order_invoice_items>
|
30 |
+
<reference name="invoice_totals">
|
31 |
+
<block type="fee/sales_order_total" name="fee.sales.order.total" />
|
32 |
+
</reference>
|
33 |
+
</sales_email_order_invoice_items>
|
34 |
+
|
35 |
+
<sales_order_creditmemo>
|
36 |
+
<reference name="creditmemo_totals">
|
37 |
+
<block type="fee/sales_order_total" name="fee.sales.order.total" />
|
38 |
+
</reference>
|
39 |
+
</sales_order_creditmemo>
|
40 |
+
<sales_order_printcreditmemo>
|
41 |
+
<reference name="creditmemo_totals">
|
42 |
+
<block type="fee/sales_order_total" name="fee.sales.order.total" />
|
43 |
+
</reference>
|
44 |
+
</sales_order_printcreditmemo>
|
45 |
+
<sales_email_order_creditmemo_items>
|
46 |
+
<reference name="creditmemo_totals">
|
47 |
+
<block type="fee/sales_order_total" name="fee.sales.order.total" />
|
48 |
+
</reference>
|
49 |
+
</sales_email_order_creditmemo_items>
|
50 |
+
</layout>
|
app/design/frontend/base/default/template/checkout/cart/shipping.phtml
ADDED
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2013 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 |
+
/* get freight products from cart */
|
28 |
+
$session = Mage::getSingleton('checkout/session');
|
29 |
+
$items = $session->getQuote()->getAllItems();
|
30 |
+
$freight_products = array();
|
31 |
+
foreach($items as $item) {
|
32 |
+
$productid = $item->getProductId();
|
33 |
+
$proModel = Mage::getModel('catalog/product')->load($productid);
|
34 |
+
$isfreight = $proModel['ship_via_freight'];
|
35 |
+
if($isfreight == 1) {
|
36 |
+
$freight_products[] = $productid;
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
if($freight_products != NULL) {
|
41 |
+
$style = 'style="display:none;"';
|
42 |
+
} else {
|
43 |
+
$style = '';
|
44 |
+
}
|
45 |
+
?>
|
46 |
+
<?php /** @var $this Mage_Checkout_Block_Cart_Shipping */ ?>
|
47 |
+
<div class="shipping" <?php echo $style; ?>>
|
48 |
+
<h2><?php echo $this->__('Estimate Shipping and Tax') ?></h2>
|
49 |
+
<div class="shipping-form">
|
50 |
+
<form action="<?php echo $this->getUrl('checkout/cart/estimatePost') ?>" method="post" id="shipping-zip-form">
|
51 |
+
<p><?php echo $this->__('Enter your destination to get a shipping estimate.') ?></p>
|
52 |
+
<ul class="form-list">
|
53 |
+
<li>
|
54 |
+
<label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
|
55 |
+
<div class="input-box">
|
56 |
+
<?php echo Mage::getBlockSingleton('directory/data')->getCountryHtmlSelect($this->getEstimateCountryId()) ?>
|
57 |
+
</div>
|
58 |
+
</li>
|
59 |
+
<?php //if($this->getStateActive()): ?>
|
60 |
+
<li>
|
61 |
+
<label for="region_id"<?php if ($this->isStateProvinceRequired()) echo ' class="required"' ?>><?php if ($this->isStateProvinceRequired()) echo '<em>*</em>' ?><?php echo $this->__('State/Province') ?></label>
|
62 |
+
<div class="input-box">
|
63 |
+
<select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>" style="display:none;"<?php echo ($this->isStateProvinceRequired() ? ' class="validate-select"' : '') ?>>
|
64 |
+
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
|
65 |
+
</select>
|
66 |
+
<script type="text/javascript">
|
67 |
+
//<![CDATA[
|
68 |
+
$('region_id').setAttribute('defaultValue', "<?php echo $this->getEstimateRegionId() ?>");
|
69 |
+
//]]>
|
70 |
+
</script>
|
71 |
+
<input type="text" id="region" name="region" value="<?php echo $this->escapeHtml($this->getEstimateRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text" style="display:none;" />
|
72 |
+
</div>
|
73 |
+
</li>
|
74 |
+
<?php //endif; ?>
|
75 |
+
<?php if($this->getCityActive()): ?>
|
76 |
+
<li>
|
77 |
+
<label for="city"<?php if ($this->isCityRequired()) echo ' class="required"' ?>><?php if ($this->isCityRequired()) echo '<em>*</em>' ?><?php echo $this->__('City') ?></label>
|
78 |
+
<div class="input-box">
|
79 |
+
<input class="input-text<?php if ($this->isCityRequired()):?> required-entry<?php endif;?>" id="city" type="text" name="estimate_city" value="<?php echo $this->escapeHtml($this->getEstimateCity()) ?>" />
|
80 |
+
</div>
|
81 |
+
</li>
|
82 |
+
<?php endif; ?>
|
83 |
+
<li>
|
84 |
+
<label for="postcode"<?php if ($this->isZipCodeRequired()) echo ' class="required"' ?>><?php if ($this->isZipCodeRequired()) echo '<em>*</em>' ?><?php echo $this->__('Zip/Postal Code') ?></label>
|
85 |
+
<div class="input-box">
|
86 |
+
<input class="input-text validate-postcode<?php if ($this->isZipCodeRequired()):?> required-entry<?php endif;?>" type="text" id="postcode" name="estimate_postcode" value="<?php echo $this->escapeHtml($this->getEstimatePostcode()) ?>" />
|
87 |
+
</div>
|
88 |
+
</li>
|
89 |
+
</ul>
|
90 |
+
<div class="buttons-set">
|
91 |
+
<button type="button" title="<?php echo $this->__('Get a Quote') ?>" onclick="coShippingMethodForm.submit()" class="button"><span><span><?php echo $this->__('Get a Quote') ?></span></span></button>
|
92 |
+
</div>
|
93 |
+
</form>
|
94 |
+
<script type="text/javascript">
|
95 |
+
//<![CDATA[
|
96 |
+
new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>);
|
97 |
+
//]]>
|
98 |
+
</script>
|
99 |
+
|
100 |
+
<?php if (($_shippingRateGroups = $this->getEstimateRates())): ?>
|
101 |
+
<form id="co-shipping-method-form" action="<?php echo $this->getUrl('checkout/cart/estimateUpdatePost') ?>">
|
102 |
+
<dl class="sp-methods">
|
103 |
+
<?php foreach ($_shippingRateGroups as $code => $_rates): ?>
|
104 |
+
<dt><?php echo $this->escapeHtml($this->getCarrierName($code)) ?></dt>
|
105 |
+
<dd>
|
106 |
+
<ul>
|
107 |
+
<?php foreach ($_rates as $_rate): ?>
|
108 |
+
<li<?php if ($_rate->getErrorMessage()) echo ' class="error-msg"';?>>
|
109 |
+
<?php if ($_rate->getErrorMessage()): ?>
|
110 |
+
<?php echo $this->escapeHtml($_rate->getErrorMessage()) ?>
|
111 |
+
<?php else: ?>
|
112 |
+
<input name="estimate_method" type="radio" value="<?php echo $this->escapeHtml($_rate->getCode()) ?>" id="s_method_<?php echo $_rate->getCode() ?>"<?php if($_rate->getCode()===$this->getAddressShippingMethod()) echo ' checked="checked"' ?> class="radio" />
|
113 |
+
<label for="s_method_<?php echo $_rate->getCode() ?>"><?php echo $this->escapeHtml($_rate->getMethodTitle()) ?>
|
114 |
+
<?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
|
115 |
+
<?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?>
|
116 |
+
<?php echo $_excl; ?>
|
117 |
+
<?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
|
118 |
+
(<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
|
119 |
+
<?php endif; ?>
|
120 |
+
</label>
|
121 |
+
<?php endif ?>
|
122 |
+
</li>
|
123 |
+
<?php endforeach; ?>
|
124 |
+
</ul>
|
125 |
+
</dd>
|
126 |
+
<?php endforeach; ?>
|
127 |
+
</dl>
|
128 |
+
<div class="buttons-set">
|
129 |
+
<button type="submit" title="<?php echo $this->__('Update Total') ?>" class="button" name="do" value="<?php echo $this->__('Update Total') ?>"><span><span><?php echo $this->__('Update Total') ?></span></span></button>
|
130 |
+
</div>
|
131 |
+
</form>
|
132 |
+
<?php endif; ?>
|
133 |
+
<script type="text/javascript">
|
134 |
+
//<![CDATA[
|
135 |
+
var coShippingMethodForm = new VarienForm('shipping-zip-form');
|
136 |
+
var countriesWithOptionalZip = <?php echo $this->helper('directory')->getCountriesWithOptionalZip(true) ?>;
|
137 |
+
|
138 |
+
coShippingMethodForm.submit = function () {
|
139 |
+
var country = $F('country');
|
140 |
+
var optionalZip = false;
|
141 |
+
|
142 |
+
for (i=0; i < countriesWithOptionalZip.length; i++) {
|
143 |
+
if (countriesWithOptionalZip[i] == country) {
|
144 |
+
optionalZip = true;
|
145 |
+
}
|
146 |
+
}
|
147 |
+
if (optionalZip) {
|
148 |
+
$('postcode').removeClassName('required-entry');
|
149 |
+
}
|
150 |
+
else {
|
151 |
+
$('postcode').addClassName('required-entry');
|
152 |
+
}
|
153 |
+
return VarienForm.prototype.submit.bind(coShippingMethodForm)();
|
154 |
+
}
|
155 |
+
//]]>
|
156 |
+
</script>
|
157 |
+
</div>
|
158 |
+
</div>
|
app/design/frontend/base/default/template/checkout/onepage/agreements.phtml
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2013 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
|
28 |
+
/**
|
29 |
+
* @see Mage_Checkout_Block_Agreements
|
30 |
+
*/
|
31 |
+
?>
|
32 |
+
|
33 |
+
<?php if (!$this->getAgreements()) return; ?>
|
34 |
+
<form action="" id="checkout-agreements" onsubmit="return false;">
|
35 |
+
<ol class="checkout-agreements">
|
36 |
+
<?php foreach ($this->getAgreements() as $_a): ?>
|
37 |
+
<li>
|
38 |
+
<div class="agreement-content"<?php echo ($_a->getContentHeight() ? ' style="height:' . $_a->getContentHeight() . '"' : '')?>>
|
39 |
+
<?php if ($_a->getIsHtml()):?>
|
40 |
+
<?php echo $_a->getContent() ?>
|
41 |
+
<?php else:?>
|
42 |
+
<?php echo nl2br($this->escapeHtml($_a->getContent())) ?>
|
43 |
+
<?php endif; ?>
|
44 |
+
</div>
|
45 |
+
<p class="agree">
|
46 |
+
<input type="checkbox" id="agreement-<?php echo $_a->getId()?>" name="agreement[<?php echo $_a->getId()?>]" value="1" title="<?php echo $this->escapeHtml($_a->getCheckboxText()) ?>" class="checkbox" /><label for="agreement-<?php echo $_a->getId()?>"><?php echo $_a->getIsHtml() ? $_a->getCheckboxText() : $this->escapeHtml($_a->getCheckboxText()) ?></label>
|
47 |
+
</p>
|
48 |
+
</li>
|
49 |
+
<?php endforeach ?>
|
50 |
+
</ol>
|
51 |
+
</form>
|
app/design/frontend/base/default/template/checkout/onepage/billing.phtml
ADDED
@@ -0,0 +1,216 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2013 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 |
+
<form id="co-billing-form" action="">
|
28 |
+
<fieldset>
|
29 |
+
<ul class="form-list" style="list-style-type:none;">
|
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 |
+
<?php if(!$this->isCustomerLoggedIn()): ?>
|
133 |
+
|
134 |
+
<?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
|
135 |
+
<?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
|
136 |
+
<?php if ($_dob->isEnabled() || $_gender->isEnabled()): ?>
|
137 |
+
<li class="fields">
|
138 |
+
<?php if ($_dob->isEnabled()): ?>
|
139 |
+
<div class="field">
|
140 |
+
<?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
|
141 |
+
</div>
|
142 |
+
<?php endif; ?>
|
143 |
+
<?php if ($_gender->isEnabled()): ?>
|
144 |
+
<div class="field">
|
145 |
+
<?php echo $_gender->setGender($this->getQuote()->getCustomerGender())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
|
146 |
+
</div>
|
147 |
+
<?php endif ?>
|
148 |
+
</li>
|
149 |
+
<?php endif ?>
|
150 |
+
|
151 |
+
<?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
|
152 |
+
<?php if ($_taxvat->isEnabled()): ?>
|
153 |
+
<li>
|
154 |
+
<?php echo $_taxvat->setTaxvat($this->getQuote()->getCustomerTaxvat())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
|
155 |
+
</li>
|
156 |
+
<?php endif ?>
|
157 |
+
|
158 |
+
<li class="fields" id="register-customer-password">
|
159 |
+
<div class="field">
|
160 |
+
<label for="billing:customer_password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
|
161 |
+
<div class="input-box">
|
162 |
+
<input type="password" name="billing[customer_password]" id="billing:customer_password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
|
163 |
+
</div>
|
164 |
+
</div>
|
165 |
+
<div class="field">
|
166 |
+
<label for="billing:confirm_password" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
|
167 |
+
<div class="input-box">
|
168 |
+
<input type="password" name="billing[confirm_password]" title="<?php echo $this->__('Confirm Password') ?>" id="billing:confirm_password" class="input-text required-entry validate-cpassword" />
|
169 |
+
</div>
|
170 |
+
</div>
|
171 |
+
</li>
|
172 |
+
<?php endif; ?>
|
173 |
+
<?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
|
174 |
+
<li class="control">
|
175 |
+
<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>
|
176 |
+
</li>
|
177 |
+
<?php else:?>
|
178 |
+
<li class="no-display"><input type="hidden" name="billing[save_in_address_book]" value="1" /></li>
|
179 |
+
<?php endif; ?>
|
180 |
+
<?php echo $this->getChildHtml('form.additional.info'); ?>
|
181 |
+
</ul>
|
182 |
+
</fieldset>
|
183 |
+
</li>
|
184 |
+
<?php /* Extensions placeholder */ ?>
|
185 |
+
<?php echo $this->getChildHtml('checkout.onepage.billing.extra')?>
|
186 |
+
<?php if ($this->canShip()): ?>
|
187 |
+
<li class="control">
|
188 |
+
<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>
|
189 |
+
<li class="control">
|
190 |
+
<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>
|
191 |
+
</li>
|
192 |
+
<?php endif; ?>
|
193 |
+
</ul>
|
194 |
+
<?php if (!$this->canShip()): ?>
|
195 |
+
<input type="hidden" name="billing[use_for_shipping]" value="1" />
|
196 |
+
<?php endif; ?>
|
197 |
+
<div class="buttons-set" id="billing-buttons-container">
|
198 |
+
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
|
199 |
+
<button type="button" title="<?php echo $this->__('Continue') ?>" class="button" onclick="billing.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
|
200 |
+
<span class="please-wait" id="billing-please-wait" style="display:none;">
|
201 |
+
<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...') ?>
|
202 |
+
</span>
|
203 |
+
</div>
|
204 |
+
</fieldset>
|
205 |
+
</form>
|
206 |
+
<script type="text/javascript">
|
207 |
+
//<![CDATA[
|
208 |
+
var billing = new Billing('co-billing-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveBilling') ?>');
|
209 |
+
var billingForm = new VarienForm('co-billing-form');
|
210 |
+
|
211 |
+
//billingForm.setElementsRelation('billing:country_id', 'billing:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
|
212 |
+
$('billing-address-select') && billing.newAddress(!$('billing-address-select').value);
|
213 |
+
|
214 |
+
var billingRegionUpdater = new RegionUpdater('billing:country_id', 'billing:region', 'billing:region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'billing:postcode');
|
215 |
+
//]]>
|
216 |
+
</script>
|
app/design/frontend/base/default/template/checkout/onepage/failure.phtml
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<div class="page-title">
|
28 |
+
<h1><?php echo $this->__('An error occurred in the process of payment') ?></h1>
|
29 |
+
</div>
|
30 |
+
<?php if ($this->getRealOrderId()) : ?><p><?php echo $this->__('Order #') . $this->getRealOrderId() ?></p><?php endif ?>
|
31 |
+
<?php if ($error = $this->getErrorMessage()) : ?><p><?php echo $error ?></p><?php endif ?>
|
32 |
+
<p><?php echo $this->__('Click <a href="%s">here</a> to continue shopping.', $this->getContinueShoppingUrl()) ?></p>
|
app/design/frontend/base/default/template/checkout/onepage/link.phtml
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2013 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 if ($this->isPossibleOnepageCheckout()):?>
|
28 |
+
<button type="button" title="<?php echo $this->__('Proceed to Checkout') ?>" class="button btn-proceed-checkout btn-checkout<?php if ($this->isDisabled()):?> no-checkout<?php endif; ?>"<?php if ($this->isDisabled()):?> disabled="disabled"<?php endif; ?> onclick="window.location='<?php echo $this->getCheckoutUrl() ?>';"><span><span><?php echo $this->__('Proceed to Checkout') ?></span></span></button>
|
29 |
+
<?php endif?>
|
app/design/frontend/base/default/template/checkout/onepage/login.phtml
ADDED
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2013 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 /* Extensions placeholder */ ?>
|
28 |
+
<?php echo $this->getChildHtml('checkout.onepage.login.extra')?>
|
29 |
+
<div class="col2-set">
|
30 |
+
<?php echo $this->getChildHtml('login_before')?>
|
31 |
+
<div class="col-1">
|
32 |
+
<h3><?php if( $this->getQuote()->isAllowedGuestCheckout() ): ?><?php echo $this->__('Checkout as a Guest or Register') ?><?php else: ?><?php echo $this->__('Register to Create an Account') ?><?php endif; ?></h3>
|
33 |
+
<?php if( $this->getQuote()->isAllowedGuestCheckout() ): ?>
|
34 |
+
<p><?php echo $this->__('Register with us for future convenience:') ?></p>
|
35 |
+
<?php else: ?>
|
36 |
+
<p><strong><?php echo $this->__('Register and save time!') ?></strong><br />
|
37 |
+
<?php echo $this->__('Register with us for future convenience:') ?></p>
|
38 |
+
<ul>
|
39 |
+
<li><?php echo $this->__('Fast and easy check out') ?></li>
|
40 |
+
<li><?php echo $this->__('Easy access to your order history and status') ?></li>
|
41 |
+
</ul>
|
42 |
+
<?php endif; ?>
|
43 |
+
<?php if( $this->getQuote()->isAllowedGuestCheckout() ): ?>
|
44 |
+
<ul class="form-list">
|
45 |
+
<?php if( $this->getQuote()->isAllowedGuestCheckout() ): ?>
|
46 |
+
<li class="control">
|
47 |
+
<input type="radio" name="checkout_method" id="login:guest" value="guest"<?php if($this->getQuote()->getCheckoutMethod()==Mage_Checkout_Model_Type_Onepage::METHOD_GUEST): ?> checked="checked"<?php endif; ?> class="radio" /><label for="login:guest"><?php echo $this->__('Checkout as Guest') ?></label>
|
48 |
+
</li>
|
49 |
+
<?php endif; ?>
|
50 |
+
<li class="control">
|
51 |
+
<input type="radio" name="checkout_method" id="login:register" value="register"<?php if($this->getQuote()->getCheckoutMethod()==Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER || !$this->getQuote()->isAllowedGuestCheckout()): ?> checked="checked"<?php endif ?> class="radio" /><label for="login:register"><?php echo $this->__('Register') ?></label>
|
52 |
+
</li>
|
53 |
+
</ul>
|
54 |
+
<h4><?php echo $this->__('Register and save time!') ?></h4>
|
55 |
+
<p><?php echo $this->__('Register with us for future convenience:') ?></p>
|
56 |
+
<ul class="ul">
|
57 |
+
<li><?php echo $this->__('Fast and easy check out') ?></li>
|
58 |
+
<li><?php echo $this->__('Easy access to your order history and status') ?></li>
|
59 |
+
</ul>
|
60 |
+
<?php else: ?>
|
61 |
+
<input type="hidden" name="checkout_method" id="login:register" value="register" checked="checked" />
|
62 |
+
<?php endif; ?>
|
63 |
+
</div>
|
64 |
+
<div class="col-2">
|
65 |
+
<h3><?php echo $this->__('Login') ?></h3>
|
66 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
67 |
+
<form id="login-form" action="<?php echo $this->getPostAction() ?>" method="post">
|
68 |
+
<fieldset>
|
69 |
+
<?php echo $this->getBlockHtml('formkey'); ?>
|
70 |
+
<h4><?php echo $this->__('Already registered?') ?></h4>
|
71 |
+
<p><?php echo $this->__('Please log in below:') ?></p>
|
72 |
+
<ul class="form-list">
|
73 |
+
<li>
|
74 |
+
<label for="login-email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
|
75 |
+
<div class="input-box">
|
76 |
+
<input type="text" class="input-text required-entry validate-email" id="login-email" name="login[username]" value="<?php echo $this->escapeHtml($this->getUsername()) ?>" />
|
77 |
+
</div>
|
78 |
+
</li>
|
79 |
+
<li>
|
80 |
+
<label for="login-password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
|
81 |
+
<div class="input-box">
|
82 |
+
<input type="password" class="input-text required-entry" id="login-password" name="login[password]" />
|
83 |
+
</div>
|
84 |
+
</li>
|
85 |
+
<?php echo $this->getChildHtml('form.additional.info'); ?>
|
86 |
+
</ul>
|
87 |
+
</fieldset>
|
88 |
+
</form>
|
89 |
+
</div>
|
90 |
+
</div>
|
91 |
+
<div class="col2-set">
|
92 |
+
<div class="col-1">
|
93 |
+
<div class="buttons-set">
|
94 |
+
<p class="required"> </p>
|
95 |
+
<button type="button" class="button" onclick="checkout.setMethod();"><span><span><?php echo ($this->getQuote()->isAllowedGuestCheckout() ? $this->__('Continue') : $this->__('Register')) ?></span></span></button>
|
96 |
+
</div>
|
97 |
+
</div>
|
98 |
+
<div class="col-2">
|
99 |
+
<div class="buttons-set">
|
100 |
+
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
|
101 |
+
<a href="<?php echo $this->getUrl('customer/account/forgotpassword') ?>" class="f-left"><?php echo $this->__('Forgot your password?') ?></a>
|
102 |
+
<button type="submit" class="button" onclick="onepageLogin(this)"><span><span><?php echo $this->__('Login') ?></span></span></button>
|
103 |
+
</div>
|
104 |
+
</div>
|
105 |
+
</div>
|
106 |
+
<script type="text/javascript">
|
107 |
+
//<![CDATA[
|
108 |
+
var loginForm = new VarienForm('login-form', true);
|
109 |
+
$('login-email').observe('keypress', bindLoginPost);
|
110 |
+
$('login-password').observe('keypress', bindLoginPost);
|
111 |
+
function bindLoginPost(evt){
|
112 |
+
if (evt.keyCode == Event.KEY_RETURN) {
|
113 |
+
loginForm.submit();
|
114 |
+
}
|
115 |
+
}
|
116 |
+
function onepageLogin(button)
|
117 |
+
{
|
118 |
+
if(loginForm.validator && loginForm.validator.validate()){
|
119 |
+
button.disabled = true;
|
120 |
+
loginForm.submit();
|
121 |
+
}
|
122 |
+
}
|
123 |
+
//]]>
|
124 |
+
</script>
|
app/design/frontend/base/default/template/checkout/onepage/payment.phtml
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2013 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 |
+
<script type="text/javascript">
|
28 |
+
//<![CDATA[
|
29 |
+
var quoteBaseGrandTotal = <?php echo (float)$this->getQuoteBaseGrandTotal(); ?>;
|
30 |
+
var checkQuoteBaseGrandTotal = quoteBaseGrandTotal;
|
31 |
+
var payment = new Payment('co-payment-form', '<?php echo $this->getUrl('checkout/onepage/savePayment') ?>');
|
32 |
+
var lastPrice;
|
33 |
+
//]]>
|
34 |
+
</script>
|
35 |
+
<form action="" id="co-payment-form">
|
36 |
+
<fieldset>
|
37 |
+
<?php echo $this->getChildHtml('methods') ?>
|
38 |
+
</fieldset>
|
39 |
+
</form>
|
40 |
+
<div class="tool-tip" id="payment-tool-tip" style="display:none;">
|
41 |
+
<div class="btn-close"><a href="#" id="payment-tool-tip-close" title="<?php echo $this->__('Close') ?>"><?php echo $this->__('Close') ?></a></div>
|
42 |
+
<div class="tool-tip-content"><img src="<?php echo $this->getSkinUrl('images/cvv.gif') ?>" alt="<?php echo $this->__('Card Verification Number Visual Reference') ?>" title="<?php echo $this->__('Card Verification Number Visual Reference') ?>" /></div>
|
43 |
+
</div>
|
44 |
+
<div class="buttons-set" id="payment-buttons-container">
|
45 |
+
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
|
46 |
+
<p class="back-link"><a href="#" onclick="checkout.back(); return false;"><small>« </small><?php echo $this->__('Back') ?></a></p>
|
47 |
+
<button type="button" class="button" onclick="payment.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
|
48 |
+
<span class="please-wait" id="payment-please-wait" style="display:none;">
|
49 |
+
<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...') ?>
|
50 |
+
</span>
|
51 |
+
</div>
|
52 |
+
<script type="text/javascript">
|
53 |
+
//<![CDATA[
|
54 |
+
function toggleToolTip(event){
|
55 |
+
if($('payment-tool-tip')){
|
56 |
+
$('payment-tool-tip').setStyle({
|
57 |
+
top: (Event.pointerY(event)-560)+'px'//,
|
58 |
+
//left: (Event.pointerX(event)+100)+'px'
|
59 |
+
})
|
60 |
+
$('payment-tool-tip').toggle();
|
61 |
+
}
|
62 |
+
Event.stop(event);
|
63 |
+
}
|
64 |
+
if($('payment-tool-tip-close')){
|
65 |
+
Event.observe($('payment-tool-tip-close'), 'click', toggleToolTip);
|
66 |
+
}
|
67 |
+
//]]>
|
68 |
+
</script>
|
69 |
+
<script type="text/javascript">
|
70 |
+
//<![CDATA[
|
71 |
+
payment.currentMethod = "<?php echo $this->getChild('methods')->getSelectedMethodCode() ?>";
|
72 |
+
//]]>
|
73 |
+
</script>
|
app/design/frontend/base/default/template/checkout/onepage/payment/info.phtml
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2013 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 |
+
<dl class="sp-methods" id="checkout-payment-method-load">
|
28 |
+
<!-- Content dynamically loaded. Content from the methods.phtml is loaded during the ajax call -->
|
29 |
+
</dl>
|
app/design/frontend/base/default/template/checkout/onepage/payment/methods.phtml
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2013 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
|
28 |
+
/**
|
29 |
+
* One page checkout payment methods
|
30 |
+
*
|
31 |
+
* @var $this Mage_Checkout_Block_Onepage_Payment_Methods
|
32 |
+
*/
|
33 |
+
?>
|
34 |
+
|
35 |
+
<?php
|
36 |
+
$methods = $this->getMethods();
|
37 |
+
$oneMethod = count($methods) <= 1;
|
38 |
+
?>
|
39 |
+
<?php if (empty($methods)): ?>
|
40 |
+
<dt>
|
41 |
+
<?php echo $this->__('No Payment Methods') ?>
|
42 |
+
</dt>
|
43 |
+
<?php else:
|
44 |
+
foreach ($methods as $_method):
|
45 |
+
$_code = $_method->getCode();
|
46 |
+
?>
|
47 |
+
<dt>
|
48 |
+
<?php if(!$oneMethod): ?>
|
49 |
+
<input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" title="<?php echo $this->escapeHtml($_method->getTitle()) ?>" onclick="payment.switchMethod('<?php echo $_code ?>')"<?php if($this->getSelectedMethodCode()==$_code): ?> checked="checked"<?php endif; ?> class="radio" />
|
50 |
+
<?php else: ?>
|
51 |
+
<span class="no-display"><input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" checked="checked" class="radio" /></span>
|
52 |
+
<?php $oneMethod = $_code; ?>
|
53 |
+
<?php endif; ?>
|
54 |
+
<label for="p_method_<?php echo $_code ?>"><?php echo $this->escapeHtml($this->getMethodTitle($_method)) ?> <?php echo $this->getMethodLabelAfterHtml($_method) ?></label>
|
55 |
+
</dt>
|
56 |
+
<?php if ($html = $this->getPaymentMethodFormHtml($_method)): ?>
|
57 |
+
<dd>
|
58 |
+
<?php echo $html; ?>
|
59 |
+
</dd>
|
60 |
+
<?php endif; ?>
|
61 |
+
<?php endforeach;
|
62 |
+
endif;
|
63 |
+
?>
|
64 |
+
<?php echo $this->getChildChildHtml('additional'); ?>
|
65 |
+
<script type="text/javascript">
|
66 |
+
//<![CDATA[
|
67 |
+
<?php echo $this->getChildChildHtml('scripts'); ?>
|
68 |
+
payment.init();
|
69 |
+
<?php if (is_string($oneMethod)): ?>
|
70 |
+
payment.switchMethod('<?php echo $oneMethod ?>');
|
71 |
+
<?php endif; ?>
|
72 |
+
//]]>
|
73 |
+
</script>
|
app/design/frontend/base/default/template/checkout/onepage/progress.phtml
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<div class="block block-progress opc-block-progress">
|
28 |
+
<div class="block-title">
|
29 |
+
<strong><span><?php echo $this->__('Your Checkout Progress') ?></span></strong>
|
30 |
+
</div>
|
31 |
+
<div class="block-content">
|
32 |
+
<dl>
|
33 |
+
<?php if ($this->getCheckout()->getStepData('billing', 'is_show')): ?>
|
34 |
+
<div id="billing-progress-opcheckout">
|
35 |
+
<?php echo $this->getChildHtml('billing.progress') ?>
|
36 |
+
</div>
|
37 |
+
<?php endif; ?>
|
38 |
+
|
39 |
+
<?php if ($this->getCheckout()->getStepData('shipping', 'is_show')): ?>
|
40 |
+
<div id="shipping-progress-opcheckout">
|
41 |
+
<?php echo $this->getChildHtml('shipping.progress') ?>
|
42 |
+
</div>
|
43 |
+
<?php endif; ?>
|
44 |
+
|
45 |
+
<?php if ($this->getCheckout()->getStepData('shipping_method', 'is_show')): ?>
|
46 |
+
<div id="shipping_method-progress-opcheckout">
|
47 |
+
<?php echo $this->getChildHtml('shippingmethod.progress') ?>
|
48 |
+
</div>
|
49 |
+
<?php endif; ?>
|
50 |
+
|
51 |
+
<?php if ($this->getCheckout()->getStepData('payment', 'is_show')): ?>
|
52 |
+
<div id="payment-progress-opcheckout">
|
53 |
+
<?php echo $this->getChildHtml('payment.progress') ?>
|
54 |
+
</div>
|
55 |
+
<?php endif; ?>
|
56 |
+
</dl>
|
57 |
+
</div>
|
58 |
+
</div>
|
59 |
+
|
app/design/frontend/base/default/template/checkout/onepage/progress/billing.phtml
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2013 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 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 |
+
</dd>
|
36 |
+
<?php else: ?>
|
37 |
+
<dt>
|
38 |
+
<?php echo $this->__('Billing Address') ?>
|
39 |
+
</dt>
|
40 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/checkout/onepage/progress/payment.phtml
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2013 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 if ($this->getCheckout()->getStepData('payment', 'complete')): ?>
|
28 |
+
<dt class="complete">
|
29 |
+
<?php echo $this->__('Payment Method') ?><span class="changelink"> <span class="separator">|</span> <a
|
30 |
+
href="#payment"
|
31 |
+
onclick="checkout.changeSection('opc-payment'); return false;"><?php echo $this->__('Change') ?></a></span>
|
32 |
+
</dt>
|
33 |
+
<dd class="complete">
|
34 |
+
<?php echo $this->getPaymentHtml() ?>
|
35 |
+
</dd>
|
36 |
+
<?php else: ?>
|
37 |
+
<dt>
|
38 |
+
<?php echo $this->__('Payment Method') ?>
|
39 |
+
</dt>
|
40 |
+
<?php endif; ?>
|
41 |
+
|
app/design/frontend/base/default/template/checkout/onepage/progress/shipping.phtml
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2013 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 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 |
+
</dd>
|
39 |
+
<?php else: ?>
|
40 |
+
<dt>
|
41 |
+
<?php echo $this->__('Shipping Address') ?>
|
42 |
+
</dt>
|
43 |
+
<?php endif; ?>
|
44 |
+
|
app/design/frontend/base/default/template/checkout/onepage/progress/shipping_method.phtml
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2013 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 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" style="min-height: 90px;">
|
34 |
+
<?php if ($this->getShippingMethod()): ?>
|
35 |
+
<?php /* freight shipping price */
|
36 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
37 |
+
$session = Mage::getSingleton('checkout/session');
|
38 |
+
$quoteid = $session->getQuoteId();
|
39 |
+
|
40 |
+
$items = Mage::getSingleton('checkout/session')->getQuote()->getAllItems();
|
41 |
+
$gettotal = '';
|
42 |
+
foreach($items as $item) {
|
43 |
+
//$getqty = $item->getQty();
|
44 |
+
$getid = $item->getProductId();
|
45 |
+
$product = Mage::getModel('catalog/product')->load($getid);
|
46 |
+
$ship_via_freight = $product->getData('ship_via_freight');
|
47 |
+
if($ship_via_freight!=1) {
|
48 |
+
$non_freight[] = $product;
|
49 |
+
?>
|
50 |
+
<!--<style>.other_method { display:none; } </style>-->
|
51 |
+
<?php } else {
|
52 |
+
$myarray[] = $product;
|
53 |
+
$allids .= $id.' '.$qtyordered.';';
|
54 |
+
}
|
55 |
+
|
56 |
+
|
57 |
+
$select = "Select * from `brst_freight_shipping` where quote_id=$quoteid AND product_id=$getid AND mark = '1'";
|
58 |
+
$getselect = $connection->query($select);
|
59 |
+
$pro_data = $getselect->fetchAll();
|
60 |
+
if($pro_data != NULL) {
|
61 |
+
$getprice = $pro_data[0]['shipping_charge'];
|
62 |
+
$gettotal += $getprice;
|
63 |
+
|
64 |
+
}
|
65 |
+
}
|
66 |
+
$gettotal = number_format($gettotal, 2, '.', ',');
|
67 |
+
if($gettotal != NULL) {
|
68 |
+
echo "<div style='height: 45px; '><div style='float: left; width: 95px;'>Freight Charges</div>"."<div style='float: right; padding-top: 12px;'>$".$gettotal.'</div></div>';
|
69 |
+
}
|
70 |
+
if($ship_via_freight == 1){
|
71 |
+
echo "<div id='ship_place' style=''><div style='float: left; width: 125px;'>Non-Freight Charges & Handling</div><div style='float: right; padding-top: 12px;'>"; }
|
72 |
+
else{
|
73 |
+
echo "<div id='ship_place' style=''><div style='float: left; width: 125px;'>Shipping and Handling</div><div style='float: right; padding-top: 12px;'>";
|
74 |
+
}
|
75 |
+
|
76 |
+
if($non_freight == NULL){
|
77 |
+
|
78 |
+
?>
|
79 |
+
<style>
|
80 |
+
#ship_place { display:none; }
|
81 |
+
</style>
|
82 |
+
<?php
|
83 |
+
|
84 |
+
}
|
85 |
+
//echo $this->getShippingDescription() ?>
|
86 |
+
|
87 |
+
<?php $_excl = $this->getShippingPriceExclTax(); ?>
|
88 |
+
<?php $_incl = $this->getShippingPriceInclTax(); ?>
|
89 |
+
<?php if ($this->helper('tax')->displayShippingPriceIncludingTax()): ?>
|
90 |
+
<?php echo $_incl; ?>
|
91 |
+
<?php else: ?>
|
92 |
+
<?php echo $_excl; ?>
|
93 |
+
<?php endif; ?>
|
94 |
+
<?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
|
95 |
+
(<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
|
96 |
+
<?php endif; ?>
|
97 |
+
<?php echo "</div></div>"; ?>
|
98 |
+
<?php else: ?>
|
99 |
+
<?php echo $this->__('Shipping method has not been selected yet') ?>
|
100 |
+
<?php endif; ?>
|
101 |
+
</dd>
|
102 |
+
<?php else: ?>
|
103 |
+
<dt>
|
104 |
+
<?php echo $this->__('Shipping Method') ?>
|
105 |
+
</dt>
|
106 |
+
<?php endif; ?>
|
107 |
+
|
app/design/frontend/base/default/template/checkout/onepage/review.phtml
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<div class="order-review" id="checkout-review-load">
|
28 |
+
<!-- Content loaded dynamically -->
|
29 |
+
</div>
|
app/design/frontend/base/default/template/checkout/onepage/review/button.phtml
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2013 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 |
+
<button type="submit" title="<?php echo $this->__('Place Order') ?>" class="button btn-checkout" onclick="review.save();"><span><span><?php echo $this->__('Place Order') ?></span></span></button>
|
app/design/frontend/base/default/template/checkout/onepage/review/info.phtml
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2013 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 echo $this->getChildHtml('items_before'); ?>
|
28 |
+
<div id="checkout-review-table-wrapper">
|
29 |
+
<table class="data-table" id="checkout-review-table">
|
30 |
+
<?php if ($this->helper('tax')->displayCartBothPrices()): $colspan = $rowspan = 2; else: $colspan = $rowspan = 1; endif; ?>
|
31 |
+
<col />
|
32 |
+
<col width="1" />
|
33 |
+
<col width="1" />
|
34 |
+
<col width="1" />
|
35 |
+
<?php if ($this->helper('tax')->displayCartBothPrices()): ?>
|
36 |
+
<col width="1" />
|
37 |
+
<col width="2" />
|
38 |
+
<?php endif; ?>
|
39 |
+
<thead>
|
40 |
+
<tr>
|
41 |
+
<th rowspan="<?php echo $rowspan ?>"><?php echo $this->__('Product Name') ?></th>
|
42 |
+
<!-- <th rowspan="<?php //echo $rowspan ?>"><?php //echo $this->__('Freight Price') ?></th>-->
|
43 |
+
<th colspan="<?php echo $colspan ?>" class="a-center"><?php echo $this->__('Price') ?></th>
|
44 |
+
<th rowspan="<?php echo $rowspan ?>" class="a-center"><?php echo $this->__('Qty') ?></th>
|
45 |
+
<th colspan="<?php echo $colspan ?>" class="a-center"><?php echo $this->__('Subtotal') ?></th>
|
46 |
+
</tr>
|
47 |
+
<?php if ($this->helper('tax')->displayCartBothPrices()): ?>
|
48 |
+
<tr>
|
49 |
+
<th class="a-right"><?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?></th>
|
50 |
+
<th><?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?></th>
|
51 |
+
<th class="a-right"><?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?></th>
|
52 |
+
<th><?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?></th>
|
53 |
+
</tr>
|
54 |
+
<?php endif; ?>
|
55 |
+
</thead>
|
56 |
+
<?php echo $this->getChildHtml('totals'); ?>
|
57 |
+
<tbody>
|
58 |
+
<?php
|
59 |
+
//$array = $this->getItems();
|
60 |
+
//echo '<pre>'; print_r($array); echo '</pre>';
|
61 |
+
|
62 |
+
foreach($this->getItems() as $_item): ?>
|
63 |
+
<?php echo $this->getItemHtml($_item)?>
|
64 |
+
<?php endforeach ?>
|
65 |
+
</tbody>
|
66 |
+
</table>
|
67 |
+
</div>
|
68 |
+
<?php echo $this->getChildHtml('items_after'); ?>
|
69 |
+
<script type="text/javascript">
|
70 |
+
//<![CDATA[
|
71 |
+
decorateTable('checkout-review-table');
|
72 |
+
truncateOptions();
|
73 |
+
//]]>
|
74 |
+
</script>
|
75 |
+
<div id="checkout-review-submit">
|
76 |
+
<?php echo $this->getChildHtml('agreements') ?>
|
77 |
+
<div class="buttons-set" id="review-buttons-container">
|
78 |
+
<p class="f-left"><?php echo $this->__('Forgot an Item?') ?> <a href="<?php echo $this->getUrl('checkout/cart') ?>"><?php echo $this->__('Edit Your Cart') ?></a></p>
|
79 |
+
<?php echo $this->getChildHtml('button') ?>
|
80 |
+
<span class="please-wait" id="review-please-wait" style="display:none;">
|
81 |
+
<img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Submitting order information...') ?>" title="<?php echo $this->__('Submitting order information...') ?>" class="v-middle" /> <?php echo $this->__('Submitting order information...') ?>
|
82 |
+
</span>
|
83 |
+
</div>
|
84 |
+
<script type="text/javascript">
|
85 |
+
//<![CDATA[
|
86 |
+
review = new Review('<?php echo $this->getUrl('checkout/onepage/saveOrder', array('form_key' => Mage::getSingleton('core/session')->getFormKey())) ?>', '<?php echo $this->getUrl('checkout/onepage/success') ?>', $('checkout-agreements'));
|
87 |
+
//]]>
|
88 |
+
</script>
|
89 |
+
</div>
|
app/design/frontend/base/default/template/checkout/onepage/review/item.phtml
ADDED
@@ -0,0 +1,262 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2013 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 $_item = $this->getItem()?>
|
28 |
+
<tr>
|
29 |
+
<td><h3 class="product-name"><?php echo $this->escapeHtml($this->getProductName()) ?></h3>
|
30 |
+
<?php if ($_options = $this->getOptionList()):?>
|
31 |
+
<dl class="item-options">
|
32 |
+
<?php foreach ($_options as $_option) : ?>
|
33 |
+
<?php $_formatedOptionValue = $this->getFormatedOptionValue($_option) ?>
|
34 |
+
<dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
|
35 |
+
<dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="truncated"<?php endif; ?>><?php echo $_formatedOptionValue['value'] ?>
|
36 |
+
<?php if (isset($_formatedOptionValue['full_view'])): ?>
|
37 |
+
<div class="truncated_full_value">
|
38 |
+
<dl class="item-options">
|
39 |
+
<dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
|
40 |
+
<dd><?php echo $_formatedOptionValue['full_view'] ?></dd>
|
41 |
+
</dl>
|
42 |
+
</div>
|
43 |
+
<?php endif; ?>
|
44 |
+
</dd>
|
45 |
+
<?php endforeach; ?>
|
46 |
+
</dl>
|
47 |
+
<?php endif;?>
|
48 |
+
<?php if ($addtInfoBlock = $this->getProductAdditionalInformationBlock()):?>
|
49 |
+
<?php echo $addtInfoBlock->setItem($_item)->toHtml() ?>
|
50 |
+
<?php endif;?>
|
51 |
+
</td>
|
52 |
+
<!--<td style="text-align: right;">-->
|
53 |
+
<?php
|
54 |
+
// $session = Mage::getSingleton('checkout/session');
|
55 |
+
// $quoteid = $session->getQuoteId();
|
56 |
+
// $resource = Mage::getSingleton('core/resource');
|
57 |
+
// $connection = $resource->getConnection('core_write');
|
58 |
+
// $productid = $_item->getProductId();
|
59 |
+
// $proModel = Mage::getModel('catalog/product')->load($productid);
|
60 |
+
// $isfreight = $proModel['ship_via_freight'];
|
61 |
+
// if($isfreight == 1) {
|
62 |
+
// $query = "Select * from `brst_freight_shipping` where product_id='$productid' AND quote_id='$quoteid'";
|
63 |
+
// $qry = $connection->query($query);
|
64 |
+
// $product_info = $qry->fetchAll();
|
65 |
+
// if($product_info != NULL) {
|
66 |
+
// $freight_price = $product_info[0]['shipping_charge'];
|
67 |
+
// } else {
|
68 |
+
// $freight_price = '';
|
69 |
+
// }
|
70 |
+
// } else {
|
71 |
+
// $freight_price = '';
|
72 |
+
// } ?>
|
73 |
+
<!--</td>-->
|
74 |
+
<?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
75 |
+
<td class="a-right">
|
76 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
77 |
+
<span class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
78 |
+
<?php else: ?>
|
79 |
+
<span class="cart-price">
|
80 |
+
<?php endif; ?>
|
81 |
+
|
82 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
83 |
+
<?php echo $this->helper('checkout')->formatPrice(($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition())); ?>
|
84 |
+
<?php else: ?>
|
85 |
+
<?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>
|
86 |
+
<?php endif; ?>
|
87 |
+
|
88 |
+
</span>
|
89 |
+
|
90 |
+
|
91 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
92 |
+
|
93 |
+
<div class="cart-tax-info" id="eunit-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
|
94 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
95 |
+
<small>
|
96 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
97 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span><br />
|
98 |
+
<?php endforeach; ?>
|
99 |
+
</small>
|
100 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
101 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
102 |
+
<span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></small></span><br />
|
103 |
+
<?php endforeach; ?>
|
104 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
105 |
+
<small>
|
106 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
107 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span><br />
|
108 |
+
<?php endforeach; ?>
|
109 |
+
</small>
|
110 |
+
<?php endif; ?>
|
111 |
+
</div>
|
112 |
+
|
113 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
114 |
+
<div class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
115 |
+
<span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?></span>
|
116 |
+
</div>
|
117 |
+
<?php endif; ?>
|
118 |
+
<?php endif; ?>
|
119 |
+
</td>
|
120 |
+
<?php endif; ?>
|
121 |
+
<?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
122 |
+
<td>
|
123 |
+
<?php $_incl = $this->helper('checkout')->getPriceInclTax($_item); ?>
|
124 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
125 |
+
<span class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
126 |
+
<?php else: ?>
|
127 |
+
<span class="cart-price">
|
128 |
+
<?php endif; ?>
|
129 |
+
|
130 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
131 |
+
<?php echo $this->helper('checkout')->formatPrice(($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item))); ?>
|
132 |
+
<?php else: ?>
|
133 |
+
<?php echo $this->helper('checkout')->formatPrice(($_incl-$_item->getWeeeTaxDisposition())) ?>
|
134 |
+
<?php endif; ?>
|
135 |
+
|
136 |
+
</span>
|
137 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
138 |
+
|
139 |
+
<div class="cart-tax-info" id="unit-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
|
140 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
141 |
+
<small>
|
142 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
143 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span><br />
|
144 |
+
<?php endforeach; ?>
|
145 |
+
</small>
|
146 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
147 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
148 |
+
<span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></small></span><br />
|
149 |
+
<?php endforeach; ?>
|
150 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
151 |
+
<small>
|
152 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
153 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span><br />
|
154 |
+
<?php endforeach; ?>
|
155 |
+
</small>
|
156 |
+
<?php endif; ?>
|
157 |
+
</div>
|
158 |
+
|
159 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
160 |
+
<div class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
161 |
+
<span class="nobr"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>:<br /> <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?></span>
|
162 |
+
</div>
|
163 |
+
<?php endif; ?>
|
164 |
+
<?php endif; ?>
|
165 |
+
</td>
|
166 |
+
<?php endif; ?>
|
167 |
+
<td class="a-center"><?php echo $_item->getQty() ?></td>
|
168 |
+
<!-- sub total starts here -->
|
169 |
+
<?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
170 |
+
<td class="a-right">
|
171 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
172 |
+
<span class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
173 |
+
<?php else: ?>
|
174 |
+
<span class="cart-price">
|
175 |
+
<?php endif; ?>
|
176 |
+
|
177 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
178 |
+
<?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
|
179 |
+
<?php else: ?>
|
180 |
+
<?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal()) ?>
|
181 |
+
<?php endif; ?>
|
182 |
+
|
183 |
+
</span>
|
184 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
185 |
+
|
186 |
+
<div class="cart-tax-info" id="esubtotal-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
|
187 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
188 |
+
<small>
|
189 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
190 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'],true,true); ?></span><br />
|
191 |
+
<?php endforeach; ?>
|
192 |
+
</small>
|
193 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
194 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
195 |
+
<span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'],true,true); ?></small></span><br />
|
196 |
+
<?php endforeach; ?>
|
197 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
198 |
+
<small>
|
199 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
200 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'],true,true); ?></span><br />
|
201 |
+
<?php endforeach; ?>
|
202 |
+
</small>
|
203 |
+
<?php endif; ?>
|
204 |
+
</div>
|
205 |
+
|
206 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
207 |
+
<div class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
208 |
+
<span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?></span>
|
209 |
+
</div>
|
210 |
+
<?php endif; ?>
|
211 |
+
<?php endif; ?>
|
212 |
+
</td>
|
213 |
+
<?php endif; ?>
|
214 |
+
<?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
215 |
+
<td>
|
216 |
+
<?php $_incl = $this->helper('checkout')->getSubtotalInclTax($_item); ?>
|
217 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
218 |
+
<span class="cart-tax-total" onclick="taxToggle('subtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
219 |
+
<?php else: ?>
|
220 |
+
<span class="cart-price">
|
221 |
+
<?php endif; ?>
|
222 |
+
|
223 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
224 |
+
<?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?>
|
225 |
+
<?php else: ?>
|
226 |
+
<?php echo $this->helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxRowDisposition()) ?>
|
227 |
+
<?php endif; ?>
|
228 |
+
|
229 |
+
</span>
|
230 |
+
|
231 |
+
|
232 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
233 |
+
|
234 |
+
<div class="cart-tax-info" id="subtotal-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
|
235 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
236 |
+
<small>
|
237 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
238 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span><br />
|
239 |
+
<?php endforeach; ?>
|
240 |
+
</small>
|
241 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
242 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
243 |
+
<span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></small></span><br />
|
244 |
+
<?php endforeach; ?>
|
245 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
246 |
+
<small>
|
247 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
248 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span><br />
|
249 |
+
<?php endforeach; ?>
|
250 |
+
</small>
|
251 |
+
<?php endif; ?>
|
252 |
+
</div>
|
253 |
+
|
254 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
255 |
+
<div class="cart-tax-total" onclick="taxToggle('subtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
256 |
+
<span class="nobr"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>:<br /> <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?></span>
|
257 |
+
</div>
|
258 |
+
<?php endif; ?>
|
259 |
+
<?php endif; ?>
|
260 |
+
</td>
|
261 |
+
<?php endif; ?>
|
262 |
+
</tr>
|
app/design/frontend/base/default/template/checkout/onepage/review/totals.phtml
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2013 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 |
+
/**
|
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 |
+
<?php echo $this->renderTotals('footer', $_colspan); ?>
|
36 |
+
<?php if ($this->needDisplayBaseGrandtotal()):?>
|
37 |
+
<tr>
|
38 |
+
<td class="a-right" colspan="<?php echo $_colspan; ?>">
|
39 |
+
<small><?php echo $this->helper('sales')->__('Your credit card will be charged for') ?></small>
|
40 |
+
</td>
|
41 |
+
<td class="a-right">
|
42 |
+
<small><?php echo $this->displayBaseGrandtotal() ?></small>
|
43 |
+
</td>
|
44 |
+
</tr>
|
45 |
+
<?php endif?>
|
46 |
+
</tfoot>
|
47 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/checkout/onepage/shipping.phtml
ADDED
@@ -0,0 +1,156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2013 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 |
+
<form action="" id="co-shipping-form">
|
28 |
+
<ul class="form-list" style="list-style-type:none;">
|
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 |
+
<?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
|
124 |
+
<li class="control">
|
125 |
+
<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>
|
126 |
+
<?php else:?>
|
127 |
+
<li class="no-display"><input type="hidden" name="shipping[save_in_address_book]" value="1" /></li>
|
128 |
+
<?php endif;?>
|
129 |
+
</ul>
|
130 |
+
</fieldset>
|
131 |
+
</li>
|
132 |
+
<li class="control">
|
133 |
+
<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>
|
134 |
+
</li>
|
135 |
+
</ul>
|
136 |
+
<div class="buttons-set" id="shipping-buttons-container">
|
137 |
+
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
|
138 |
+
<p class="back-link"><a href="#" onclick="checkout.back(); return false;"><small>« </small><?php echo $this->__('Back') ?></a></p>
|
139 |
+
<button type="button" class="button" title="<?php echo $this->__('Continue') ?>" onclick="shipping.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
|
140 |
+
<span id="shipping-please-wait" class="please-wait" style="display:none;">
|
141 |
+
<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...') ?>
|
142 |
+
</span>
|
143 |
+
</div>
|
144 |
+
</form>
|
145 |
+
<script type="text/javascript">
|
146 |
+
//<![CDATA[
|
147 |
+
var shipping = new Shipping('co-shipping-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveShipping') ?>',
|
148 |
+
'<?php echo $this->getUrl('checkout/onepage/shippingMethod') ?>');
|
149 |
+
var shippingForm = new VarienForm('co-shipping-form');
|
150 |
+
shippingForm.extraChildParams = ' onchange="shipping.setSameAsBilling(false);"';
|
151 |
+
//shippingForm.setElementsRelation('shipping:country_id', 'shipping:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
|
152 |
+
$('shipping-address-select') && shipping.newAddress(!$('shipping-address-select').value);
|
153 |
+
|
154 |
+
var shippingRegionUpdater = new RegionUpdater('shipping:country_id', 'shipping:region', 'shipping:region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'shipping:postcode');
|
155 |
+
//]]>
|
156 |
+
</script>
|
app/design/frontend/base/default/template/checkout/onepage/shipping_method.phtml
ADDED
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2013 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
|
28 |
+
$session = Mage::getSingleton('checkout/session');
|
29 |
+
$items = $session->getQuote()->getAllItems();
|
30 |
+
$myarray = array();
|
31 |
+
foreach($items as $item) {
|
32 |
+
$id = $item->getProductId();
|
33 |
+
$qtyordered = $item->getQty();
|
34 |
+
$cart_products[$id] = $qtyordered;
|
35 |
+
$product = Mage::getModel('catalog/product')->load($id);
|
36 |
+
$ship_via_freight = $product->getData('ship_via_freight');
|
37 |
+
if($ship_via_freight!=1) {
|
38 |
+
$non_freight[] = $product;
|
39 |
+
} else {
|
40 |
+
$myarray[] = $product;
|
41 |
+
$allids .= $id.' '.$qtyordered.';';
|
42 |
+
}
|
43 |
+
}
|
44 |
+
$attribute1 = Mage::getModel('eav/config')->getAttribute('catalog_product', 'origin_warehouse');
|
45 |
+
foreach ( $attribute1->getSource()->getAllOptions(true, true) as $opt_menu)
|
46 |
+
{
|
47 |
+
$m1_attribute[$opt_menu['value']] = $opt_menu['label'];
|
48 |
+
}
|
49 |
+
$ware_array = array();
|
50 |
+
foreach($myarray as $proarray) {
|
51 |
+
$warehouseid = $m1_attribute[$proarray['origin_warehouse']];
|
52 |
+
|
53 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
54 |
+
$ware_query = "SELECT * FROM `brst_ship_warehouses` WHERE short_name = '$warehouseid'";
|
55 |
+
$ware_results = $connection->fetchAll($ware_query);
|
56 |
+
if($ware_results != NULL) {
|
57 |
+
$warehousename = $ware_results[0]['short_name'];
|
58 |
+
}
|
59 |
+
|
60 |
+
if (array_key_exists($warehousename, $ware_array)) {
|
61 |
+
array_push($ware_array[$warehousename],$proarray);
|
62 |
+
} else {
|
63 |
+
$ware_array[$warehousename] = array($proarray);
|
64 |
+
}
|
65 |
+
}
|
66 |
+
$subtotal = Mage::helper('checkout/cart')->getQuote()->getSubtotal() ;
|
67 |
+
|
68 |
+
$discount = Mage::getStoreConfig('carriers/freightcenter/discount');
|
69 |
+
if($discount == '1'){
|
70 |
+
$discount_amount = Mage::getStoreConfig('carriers/freightcenter/discount_amount');
|
71 |
+
$discount_price = Mage::getStoreConfig('carriers/freightcenter/discount_price');
|
72 |
+
|
73 |
+
}
|
74 |
+
else{
|
75 |
+
$discount_amount = $subtotal + 100;
|
76 |
+
$discount_price = '0';
|
77 |
+
}
|
78 |
+
|
79 |
+
|
80 |
+
$breakout_lineitems = Mage::getStoreConfig('carriers/freightcenter/breakout_lineitems');
|
81 |
+
if($breakout_lineitems == '1'){
|
82 |
+
$ware = count($ware_array); }
|
83 |
+
else{
|
84 |
+
$ware = 1;
|
85 |
+
}
|
86 |
+
|
87 |
+
if($discount == '1') {
|
88 |
+
if($subtotal > $discount_amount){
|
89 |
+
$ware = 1;
|
90 |
+
|
91 |
+
}
|
92 |
+
}
|
93 |
+
?>
|
94 |
+
<form id="co-shipping-method-form" action="">
|
95 |
+
<div id="checkout-shipping-method-load">
|
96 |
+
<!-- Content loaded dynamically -->
|
97 |
+
</div>
|
98 |
+
<script type="text/javascript">
|
99 |
+
//<![CDATA[
|
100 |
+
var shippingMethod = new ShippingMethod('co-shipping-method-form', "<?php echo $this->getUrl('checkout/onepage/saveShippingMethod') ?>");
|
101 |
+
//]]>
|
102 |
+
</script>
|
103 |
+
<div id="onepage-checkout-shipping-method-additional-load">
|
104 |
+
<?php echo $this->getChildHtml('additional') ?>
|
105 |
+
</div>
|
106 |
+
<div class="buttons-set" id="shipping-method-buttons-container">
|
107 |
+
<p class="back-link"><a href="#" onclick="checkout.back(); return false;"><small>« </small><?php echo $this->__('Back') ?></a></p>
|
108 |
+
<?php
|
109 |
+
$active = Mage::getStoreConfig('carriers/freightcenter/active');
|
110 |
+
|
111 |
+
//if($ship_via_freight == '1'){
|
112 |
+
if($active == '1'){
|
113 |
+
?>
|
114 |
+
<button type="button" class="button" onclick="CheckCarrierRates();"><span><span><?php echo $this->__('Continue') ?></span></span></button><?php }
|
115 |
+
// }
|
116 |
+
else { ?>
|
117 |
+
<button type="button" class="button" onclick="shippingMethod.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
|
118 |
+
<?php }?>
|
119 |
+
<span id="shipping-method-please-wait" class="please-wait" style="display:none;">
|
120 |
+
<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...') ?>
|
121 |
+
</span>
|
122 |
+
</div>
|
123 |
+
</form>
|
124 |
+
<script type="text/javascript">
|
125 |
+
function CheckCarrierRates() {
|
126 |
+
// var length = jQuery('input[class=ajax]').length;
|
127 |
+
var length = <?php echo $ware; ?>;
|
128 |
+
//alert(length);
|
129 |
+
var ischeck = jQuery('input[class=ajax]:radio:checked').length;
|
130 |
+
//alert(length);
|
131 |
+
//alert(ischeck);
|
132 |
+
if(length === ischeck) {
|
133 |
+
shippingMethod.save();
|
134 |
+
jQuery(".ajax").attr('class', 'ajax');
|
135 |
+
} else {
|
136 |
+
alert('Please Select Carrier Rate.');return false;
|
137 |
+
}
|
138 |
+
}
|
139 |
+
</script>
|
app/design/frontend/base/default/template/checkout/onepage/shipping_method/additional.phtml
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2013 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 if (!$this->getQuote()->isVirtual()): ?>
|
28 |
+
<?php echo $this->helper('giftmessage/message')->getInline('onepage_checkout', $this->getQuote(), $this->getDontDisplayContainer()) ?>
|
29 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/checkout/onepage/shipping_method/available.phtml
ADDED
@@ -0,0 +1,2096 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2013 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 |
+
?>
|
28 |
+
<style>
|
29 |
+
.pro_list {
|
30 |
+
font-size: 15px;
|
31 |
+
list-style: disc outside none;
|
32 |
+
}
|
33 |
+
.car_show {
|
34 |
+
font-weight: bold;
|
35 |
+
}
|
36 |
+
hr {
|
37 |
+
color: #CCC;
|
38 |
+
background-color: #CCC;
|
39 |
+
border: none;
|
40 |
+
height: 2px;
|
41 |
+
margin: 20px 0 20px 0;
|
42 |
+
}
|
43 |
+
.freight_box ul {
|
44 |
+
margin: 10px 0 20px 46px;
|
45 |
+
padding: 0 0 0 3px;
|
46 |
+
list-style-type: square;
|
47 |
+
}
|
48 |
+
.freight_box {
|
49 |
+
padding: 0 20px 0 20px;
|
50 |
+
}
|
51 |
+
input[type="checkbox"] {
|
52 |
+
margin: 0 3px 0 0;
|
53 |
+
}
|
54 |
+
.accessories label {
|
55 |
+
margin: 0 16px 0 0;
|
56 |
+
}
|
57 |
+
.sp-methods{margin:0 0 0 20px;}
|
58 |
+
</style>
|
59 |
+
<?php
|
60 |
+
/** @var $this Mage_Checkout_Block_Onepage_Shipping_Method_Available */
|
61 |
+
?>
|
62 |
+
<?php
|
63 |
+
$_shippingRateGroups = $this->getShippingRates();
|
64 |
+
?>
|
65 |
+
<?php
|
66 |
+
if (!$_shippingRateGroups):
|
67 |
+
?>
|
68 |
+
<title></title>
|
69 |
+
<p>
|
70 |
+
<?php
|
71 |
+
echo $this->__('Sorry, no quotes are available for this order at this time.aa');
|
72 |
+
?>
|
73 |
+
</p>
|
74 |
+
<?php
|
75 |
+
else:
|
76 |
+
$address = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getpostcode();
|
77 |
+
$home_url = Mage::helper('core/url')->getHomeUrl();
|
78 |
+
$home = explode("index.php", $home_url);
|
79 |
+
//echo '<pre>'; print_r($home);exit;
|
80 |
+
$hello = $home[0];
|
81 |
+
$current_page = $hello . 'api_check_new.php';
|
82 |
+
$remo = $hello . 'RemoveFreight.php';
|
83 |
+
$session = Mage::getSingleton('checkout/session');
|
84 |
+
$quote_id = $session->getQuoteId();
|
85 |
+
$items = $session->getQuote()->getAllItems();
|
86 |
+
//echo '<pre>';print_r($items); echo '</pre>';
|
87 |
+
?>
|
88 |
+
<input type="hidden" value="<?php
|
89 |
+
echo $address;
|
90 |
+
?>" name="<?php
|
91 |
+
echo $address;
|
92 |
+
?>" id="postaladdress" />
|
93 |
+
<input type="hidden" value="<?php
|
94 |
+
echo $current_page;
|
95 |
+
?>" name="<?php
|
96 |
+
echo $current_page;
|
97 |
+
?>" id="url"/>
|
98 |
+
<input type="hidden" value="<?php
|
99 |
+
echo $remo;
|
100 |
+
?>" name="<?php
|
101 |
+
echo $remo;
|
102 |
+
?>" id="remo"/>
|
103 |
+
<?php
|
104 |
+
$allids = '';
|
105 |
+
$myarray = array();
|
106 |
+
$non_freight = array();
|
107 |
+
$cart_products = array();
|
108 |
+
foreach ($items as $item) {
|
109 |
+
$id = $item->getProductId();
|
110 |
+
$qtyordered = $item->getQty();
|
111 |
+
$cart_products[$id] = $qtyordered;
|
112 |
+
$product = Mage::getModel('catalog/product')->load($id);
|
113 |
+
$ship_via_freight = $product->getData('ship_via_freight');
|
114 |
+
if ($ship_via_freight != 1) {
|
115 |
+
$non_freight[] = $product;
|
116 |
+
?>
|
117 |
+
<?php
|
118 |
+
} else {
|
119 |
+
$myarray[] = $product;
|
120 |
+
$allids .= $id . ' ' . $qtyordered . ';';
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
$subtotal = Mage::helper('checkout/cart')->getQuote()->getSubtotal();
|
125 |
+
$freightuser = Mage::getStoreConfig('carriers/freightcenter/freightuser');
|
126 |
+
$freightpwd = Mage::getStoreConfig('carriers/freightcenter/freightpwd');
|
127 |
+
|
128 |
+
$discount = Mage::getStoreConfig('carriers/freightcenter/discount');
|
129 |
+
if ($discount == '1') {
|
130 |
+
$discount_amount = Mage::getStoreConfig('carriers/freightcenter/discount_amount');
|
131 |
+
$discount_price = Mage::getStoreConfig('carriers/freightcenter/discount_price');
|
132 |
+
|
133 |
+
} else {
|
134 |
+
$discount_amount = $subtotal + 100;
|
135 |
+
$discount_price = '0';
|
136 |
+
}
|
137 |
+
|
138 |
+
|
139 |
+
//echo "<pre>";print_r($myarray);exit;
|
140 |
+
/* hide shipping methods */
|
141 |
+
if ($non_freight == NULL) {
|
142 |
+
$ship_style = 'style="display:none;"';
|
143 |
+
} else if ($non_freight != NULL && $myarray != NULL) {
|
144 |
+
$freight_box = 'style="display:block;"';
|
145 |
+
} else {
|
146 |
+
$ship_style = 'style="display:block;"';
|
147 |
+
$freight_box = 'style="display:none;"';
|
148 |
+
}
|
149 |
+
|
150 |
+
$carriers_selected = Mage::getStoreConfig('carriers/freightcenter/positions');
|
151 |
+
if ($carriers_selected == NULL) {
|
152 |
+
$carrier_code = 'AAACOOPER';
|
153 |
+
} else {
|
154 |
+
if (strstr($carriers_selected, ',')) {
|
155 |
+
$all_carriers = explode(',', $carriers_selected);
|
156 |
+
$carrier_code = $all_carriers[0];
|
157 |
+
} else {
|
158 |
+
$carrier_code = $carriers_selected;
|
159 |
+
}
|
160 |
+
}
|
161 |
+
|
162 |
+
|
163 |
+
$active = Mage::getStoreConfig('carriers/freightcenter/active');
|
164 |
+
if ($active == '1') {
|
165 |
+
|
166 |
+
$breakout_lineitems = Mage::getStoreConfig('carriers/freightcenter/breakout_lineitems');
|
167 |
+
$sandbox = Mage::getStoreConfig('carriers/freightcenter/sandbox');
|
168 |
+
/* $apishipmenturl = Mage::getStoreConfig('carriers/freightcenter/apishipmenturl');
|
169 |
+
$apicarriersurl = Mage::getStoreConfig('carriers/freightcenter/apicarriersurl');
|
170 |
+
$apirateurl = Mage::getStoreConfig('carriers/freightcenter/apirateurl'); */
|
171 |
+
if ($sandbox == '1') {
|
172 |
+
$host = "sandbox.freightcenter.com";
|
173 |
+
$apishipmenturl = "http://sandbox.freightcenter.com/v04/shipments.asmx";
|
174 |
+
$apirateurl = "http://sandbox.freightcenter.com/v04/rates.asmx";
|
175 |
+
$apicarriersurl = "http://sandbox.freightcenter.com/v04/carriers.asmx";
|
176 |
+
} else {
|
177 |
+
$host = "api.freightcenter.com";
|
178 |
+
$apishipmenturl = "http://api.freightcenter.com/v04/shipments.asmx";
|
179 |
+
$apirateurl = "http://api.freightcenter.com/v04/rates.asmx";
|
180 |
+
$apicarriersurl = "http://api.freightcenter.com/v04/carriers.asmx";
|
181 |
+
}
|
182 |
+
|
183 |
+
if ($breakout_lineitems == '1') {
|
184 |
+
if ($discount == '1') {
|
185 |
+
if ($subtotal > $discount_amount) {
|
186 |
+
?>
|
187 |
+
<div class="freight_ship" <?php
|
188 |
+
echo $freight_box;
|
189 |
+
?>>
|
190 |
+
<?php
|
191 |
+
if ($myarray != NULL) {
|
192 |
+
?>
|
193 |
+
<input type="hidden" value="<?php
|
194 |
+
echo $this->getBaseUrl();
|
195 |
+
?>" id="baseurl" />
|
196 |
+
<input type="hidden" value="<?php
|
197 |
+
echo $this->getSkinUrl('images/opc-ajax-loader.gif');
|
198 |
+
?>" id="loader_url" />
|
199 |
+
<input type="hidden" value="<?php
|
200 |
+
echo $allids;
|
201 |
+
?>" id="freight_ids" />
|
202 |
+
<input type="hidden" value="<?php
|
203 |
+
echo $address;
|
204 |
+
?>" id="post_address" />
|
205 |
+
<input type="hidden" value="<?php
|
206 |
+
echo $quote_id;
|
207 |
+
?>" id="quoteid" />
|
208 |
+
<?php
|
209 |
+
$current_freight_user = Mage::getStoreConfig('carriers/freightcenter/dest_loctype');
|
210 |
+
$CarrierCode = Mage::getStoreConfig('carriers/freightcenter/positions');
|
211 |
+
$Carrierdisplay = Mage::getStoreConfig('carriers/freightcenter/carrier_display');
|
212 |
+
$MarkupType = Mage::getStoreConfig('carriers/freightcenter/markup_type');
|
213 |
+
$MarkupPrice = Mage::getStoreConfig('carriers/freightcenter/markup_price');
|
214 |
+
$CarrierCode = explode(",", $CarrierCode);
|
215 |
+
//echo count($CarrierCode);
|
216 |
+
//if( $Carrierdisplay > count($CarrierCode))
|
217 |
+
// {
|
218 |
+
// $Carrierdisplay = count($CarrierCode);
|
219 |
+
// }
|
220 |
+
?>
|
221 |
+
<!-- <div id="carrier_radio_select_div"></div>
|
222 |
+
<p style="font-size: 15px; font-weight: 600;">Select Carrier</p>
|
223 |
+
<?php
|
224 |
+
// for($modz=0;$modz<$Carrierdisplay; $modz++){
|
225 |
+
?>
|
226 |
+
<input type="radio" class="ajax_new" value="<?php
|
227 |
+
echo $CarrierCode[$modz];
|
228 |
+
?>" name="Carrier" id="ajax_new" onclick="get_carrier();"/>
|
229 |
+
<label for="ajax_new"><?php
|
230 |
+
echo $CarrierCode[$modz];
|
231 |
+
?> </br>
|
232 |
+
</label> -->
|
233 |
+
|
234 |
+
<?php
|
235 |
+
// }
|
236 |
+
$crra = explode(",", $current_freight_user);
|
237 |
+
if (count($crra) < 0) {
|
238 |
+
} else {
|
239 |
+
?>
|
240 |
+
<div>
|
241 |
+
<!-- <h4>Freight Cost</h4>-->
|
242 |
+
<h4>Select Location Type</h4>
|
243 |
+
<select class="required-entry required-entry select" onchange="apicallrate_location(this.value);" name="location_type" id="location_type">
|
244 |
+
<?php
|
245 |
+
foreach ($crra as $crr) {
|
246 |
+
?>
|
247 |
+
<option value="<?php
|
248 |
+
echo str_replace(' ', '', $crr);
|
249 |
+
?>">
|
250 |
+
<?php
|
251 |
+
echo $crr;
|
252 |
+
?>
|
253 |
+
</option>
|
254 |
+
<?php
|
255 |
+
}
|
256 |
+
?>
|
257 |
+
</select>
|
258 |
+
</div>
|
259 |
+
<?php
|
260 |
+
}
|
261 |
+
?>
|
262 |
+
<div style="margin-top: 10px">
|
263 |
+
<!-- <h4>Select Extra Services</h4>-->
|
264 |
+
<div class="accessories">
|
265 |
+
<?php //echo $crra['0']; ?>
|
266 |
+
<?php if($crra['0'] == 'Residential') { ?>
|
267 |
+
<input onclick="apicallrateRates();" id="resident1" type="checkbox" value="DEST_INSIDE_DEL" /><label for="resident1" class="access_class">Threshold Delivery</label>
|
268 |
+
<?php } else if($crra['0'] == 'Business With Dock or Forklift') {?>
|
269 |
+
<input onclick="apicallrateRates();" id="buswith1" type="checkbox" value="DEST_NOTIFY" /><label for="buswith1" class="access_class">Call before Delivery</label>
|
270 |
+
<input onclick="apicallrateRates();" id="buswith2" type="checkbox" value="DEST_INSIDE_DEL" /><label for="buswith2" class="access_class">Threshold Delivery</label>
|
271 |
+
<input onclick="apicallrateRates();" id="buswith3" type="checkbox" value="DEST_LIMITED_DEL" /><label for="buswith3" class="access_class">Limited Access Delivery</label>
|
272 |
+
|
273 |
+
<?php } else if($crra['0'] == 'Business Without Dock or Forklift') { ?>
|
274 |
+
<input onclick="apicallrateRates();" id="buswithout1" type="checkbox" value="DEST_NOTIFY" /><label for="buswithout1" class="access_class">Call before Delivery</label>
|
275 |
+
<input onclick="apicallrateRates();" id="buswithout2" type="checkbox" value="DEST_INSIDE_DEL" /><label for="buswithout2" class="access_class">Threshold Delivery</label>
|
276 |
+
<input onclick="apicallrateRates();" id="buswithout4" type="checkbox" value="DEST_LIMITED_DEL" /><label for="buswithout4" class="access_class">Limited Access Delivery</label>
|
277 |
+
|
278 |
+
<?php } else if($crra['0'] == 'Construction Site') { ?>
|
279 |
+
<input onclick="apicallrateRates();" id="const1" type="checkbox" value="DEST_LIFT_GATE" /><label for="const1" class="access_class">Lift Gate at Delivery Point</label>
|
280 |
+
|
281 |
+
<?php } else if($crra['0'] == 'Convention Center or Tradeshow') { ?>
|
282 |
+
<input onclick="apicallrateRates();" id="convent1" type="checkbox" value="DEST_LIFT_GATE" /><label for="convent1" class="access_class">Lift Gate at Delivery Point</label>
|
283 |
+
|
284 |
+
<?php } else if($crra['0'] == 'Terminal') { ?>
|
285 |
+
<input onclick="apicallrateRates();" id="terminal1" type="checkbox" value="DEST_NOTIFY" /><label for="terminal1" class="access_class">Call before Delivery</label>
|
286 |
+
|
287 |
+
<?php } ?>
|
288 |
+
<!-- <input onclick="apicallrateRates();" id="resident1" type="checkbox" value="DEST_INSIDE_DEL" />
|
289 |
+
<label for="resident1" class="access_class">Threshold Delivery</label>
|
290 |
+
<input onclick="getaccessRates();" id="resident2" type="checkbox" value="DEST_LIFT_GATE" />
|
291 |
+
<label for="resident2" class="access_class">Lift Gate at Delivery Point</label>-->
|
292 |
+
</div>
|
293 |
+
</div>
|
294 |
+
<?php
|
295 |
+
}
|
296 |
+
|
297 |
+
?>
|
298 |
+
<hr />
|
299 |
+
<div class="freight_box">
|
300 |
+
<h3>Freight Shipping:</h3>
|
301 |
+
<ul>
|
302 |
+
<?php
|
303 |
+
$attribute_f = Mage::getModel('eav/config')->getAttribute('catalog_product', 'freight_class');
|
304 |
+
foreach ($attribute_f->getSource()->getAllOptions(true, true) as $opt_menuf) {
|
305 |
+
$f_attribute[$opt_menuf['value']] = $opt_menuf['label'];
|
306 |
+
}
|
307 |
+
|
308 |
+
$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'packaging_type');
|
309 |
+
foreach ($attribute->getSource()->getAllOptions(true, true) as $opt_menu1) {
|
310 |
+
$m_attribute[$opt_menu1['value']] = $opt_menu1['label'];
|
311 |
+
}
|
312 |
+
$packaging_type = $m_attribute[$mainarray['packaging_type']];
|
313 |
+
|
314 |
+
$attribute1 = Mage::getModel('eav/config')->getAttribute('catalog_product', 'origin_warehouse');
|
315 |
+
foreach ($attribute1->getSource()->getAllOptions(true, true) as $opt_menu) {
|
316 |
+
$m1_attribute[$opt_menu['value']] = $opt_menu['label'];
|
317 |
+
}
|
318 |
+
|
319 |
+
/* combine products by warehouse */
|
320 |
+
|
321 |
+
foreach ($myarray as $mainarray) {
|
322 |
+
$product_id = $mainarray['entity_id'];
|
323 |
+
//$product_descriptions = $mainarray['description'];
|
324 |
+
$product_description = str_replace(' ', '', $mainarray['description']);
|
325 |
+
$product_name = $mainarray['name'];
|
326 |
+
$freight_length = $mainarray['freight_length'];
|
327 |
+
$freight_width = $mainarray['freight_width'];
|
328 |
+
$freight_height = $mainarray['freight_height'];
|
329 |
+
$nmfc = $mainarray['nmfc'];
|
330 |
+
//$freight_class = $mainarray['freight_class'];
|
331 |
+
$quantity = $cart_products[$product_id];
|
332 |
+
$weight = ($mainarray['weight'] * $quantity);
|
333 |
+
$freight_class = $f_attribute[$mainarray['freight_class']];
|
334 |
+
|
335 |
+
|
336 |
+
$ware_id = $m1_attribute[$mainarray['origin_warehouse']];
|
337 |
+
$resource = Mage::getSingleton('core/resource');
|
338 |
+
$readConnection = $resource->getConnection('core_read');
|
339 |
+
$tableNamep = $resource->getTableName('brst_ship_warehouses');
|
340 |
+
$queryp = "SELECT * FROM $tableNamep WHERE short_name = '$ware_id' LIMIT 10";
|
341 |
+
$results = $readConnection->fetchAll($queryp);
|
342 |
+
?>
|
343 |
+
<li>
|
344 |
+
<?php
|
345 |
+
echo $product_name;
|
346 |
+
?>
|
347 |
+
</li>
|
348 |
+
<?php
|
349 |
+
|
350 |
+
foreach ($results as $ware_result) {
|
351 |
+
$warehouse_name = $ware_result['short_name'];
|
352 |
+
//$warehouse_location_types = $ware_result['location_type'];
|
353 |
+
$warehouse_location_type = str_replace(' ', '', $ware_result['location_type']);
|
354 |
+
$ware_cmpny_postcode = $ware_result['cmpny_postcode'];
|
355 |
+
|
356 |
+
}
|
357 |
+
?>
|
358 |
+
<input type="hidden" value="<?php
|
359 |
+
echo $product_id;
|
360 |
+
?>" name="<?php
|
361 |
+
echo $product_id;
|
362 |
+
?>" id="product_id"/>
|
363 |
+
<input type="hidden" value="<?php
|
364 |
+
echo $product_description;
|
365 |
+
?>" name="<?php
|
366 |
+
echo $product_description;
|
367 |
+
?>" id="product_description"/>
|
368 |
+
<input type="hidden" value="<?php
|
369 |
+
echo $product_name;
|
370 |
+
?>" name="<?php
|
371 |
+
echo $product_name;
|
372 |
+
?>" id="product_name"/>
|
373 |
+
<input type="hidden" value="<?php
|
374 |
+
echo $freight_length;
|
375 |
+
?>" name="<?php
|
376 |
+
echo $freight_length;
|
377 |
+
?>" id="freight_length"/>
|
378 |
+
<input type="hidden" value="<?php
|
379 |
+
echo $freight_width;
|
380 |
+
?>" name="<?php
|
381 |
+
echo $freight_width;
|
382 |
+
?>" id="freight_width"/>
|
383 |
+
<input type="hidden" value="<?php
|
384 |
+
echo $freight_height;
|
385 |
+
?>" name="<?php
|
386 |
+
echo $freight_height;
|
387 |
+
?>" id="freight_height"/>
|
388 |
+
<input type="hidden" value="<?php
|
389 |
+
echo $nmfc;
|
390 |
+
?>" name="<?php
|
391 |
+
echo $nmfc;
|
392 |
+
?>" id="nmfc"/>
|
393 |
+
<input type="hidden" value="<?php
|
394 |
+
echo $weight;
|
395 |
+
?>" name="<?php
|
396 |
+
echo $weight;
|
397 |
+
?>" id="weight"/>
|
398 |
+
<input type="hidden" value="<?php
|
399 |
+
echo $freight_class;
|
400 |
+
?>" name="<?php
|
401 |
+
echo $freight_class;
|
402 |
+
?>" id="freight_class"/>
|
403 |
+
<input type="hidden" value="<?php
|
404 |
+
echo $packaging_type;
|
405 |
+
?>" name="<?php
|
406 |
+
echo $packaging_type;
|
407 |
+
?>" id="packaging_type"/>
|
408 |
+
<input type="hidden" value="<?php
|
409 |
+
echo $address;
|
410 |
+
?>" name="<?php
|
411 |
+
echo $address;
|
412 |
+
?>" id="address"/>
|
413 |
+
<input type="hidden" value="<?php
|
414 |
+
echo $current_page;
|
415 |
+
?>" name="<?php
|
416 |
+
echo $current_page;
|
417 |
+
?>" id="current_page"/>
|
418 |
+
<input type="hidden" value="<?php
|
419 |
+
echo $ware_cmpny_postcode;
|
420 |
+
?>" name="<?php
|
421 |
+
echo $ware_cmpny_postcode;
|
422 |
+
?>" id="ware_cmpny_postcode"/>
|
423 |
+
<input type="hidden" value="<?php
|
424 |
+
echo $warehouse_name;
|
425 |
+
?>" name="<?php
|
426 |
+
echo $warehouse_name;
|
427 |
+
?>" id="warehouse_name"/>
|
428 |
+
<input type="hidden" value="<?php
|
429 |
+
echo $warehouse_location_type;
|
430 |
+
?>" name="<?php
|
431 |
+
echo $warehouse_location_type;
|
432 |
+
?>" id="warehouse_location_type"/>
|
433 |
+
<input type="hidden" value="<?php
|
434 |
+
echo $quote_id;
|
435 |
+
?>" name="<?php
|
436 |
+
echo $quote_id;
|
437 |
+
?>" id="quote_id"/>
|
438 |
+
<input type="hidden" onclick="apicallrate();" name="freight Products" id="newCheck<?php
|
439 |
+
echo $product_id;
|
440 |
+
?>" />
|
441 |
+
<?php
|
442 |
+
|
443 |
+
|
444 |
+
}
|
445 |
+
|
446 |
+
?>
|
447 |
+
<script>
|
448 |
+
jQuery( document ).ready(function() {
|
449 |
+
//alert('hello');
|
450 |
+
apicallrate();
|
451 |
+
});
|
452 |
+
</script>
|
453 |
+
<div style="display: block; height: 35px; margin-top: 20px;" id="pls_wait"> <span id="loader_loctype<?php
|
454 |
+
echo $product_id;
|
455 |
+
?>"> <img class="v-middle" title="Loading carrier rates..." alt="Loading carrier rates..." src="<?php
|
456 |
+
echo $this->getSkinUrl('images/opc-ajax-loader.gif');
|
457 |
+
?>"> </span> <span>Loading Carrier Rates</span> </div>
|
458 |
+
<div id="ajax_response_else"></div>
|
459 |
+
</ul>
|
460 |
+
</div>
|
461 |
+
<?php
|
462 |
+
if ($non_freight != NULL) {
|
463 |
+
?>
|
464 |
+
<hr />
|
465 |
+
<div class="freight_box">
|
466 |
+
<h3>Parcel (Non-Freight) Shipping</h3>
|
467 |
+
<p>The following items do not require freight shipping. These items ship via parcel providers:</p>
|
468 |
+
<ul>
|
469 |
+
<?php
|
470 |
+
foreach ($non_freight as $non) {
|
471 |
+
?>
|
472 |
+
<li>
|
473 |
+
<?php
|
474 |
+
echo $non['name'];
|
475 |
+
?>
|
476 |
+
</li>
|
477 |
+
<?php
|
478 |
+
}
|
479 |
+
?>
|
480 |
+
</ul>
|
481 |
+
</div>
|
482 |
+
<?php
|
483 |
+
}
|
484 |
+
?>
|
485 |
+
</div>
|
486 |
+
<?php
|
487 |
+
} else {
|
488 |
+
?>
|
489 |
+
<div class="freight_ship" <?php
|
490 |
+
echo $freight_box;
|
491 |
+
?>>
|
492 |
+
<?php
|
493 |
+
if ($myarray != NULL) {
|
494 |
+
?>
|
495 |
+
<input type="hidden" value="<?php
|
496 |
+
echo $this->getBaseUrl();
|
497 |
+
?>" id="baseurl" />
|
498 |
+
<input type="hidden" value="<?php
|
499 |
+
echo $this->getSkinUrl('images/opc-ajax-loader.gif');
|
500 |
+
?>" id="loader_url" />
|
501 |
+
<input type="hidden" value="<?php
|
502 |
+
echo $allids;
|
503 |
+
?>" id="freight_ids" />
|
504 |
+
<input type="hidden" value="<?php
|
505 |
+
echo $address;
|
506 |
+
?>" id="post_address" />
|
507 |
+
<input type="hidden" value="<?php
|
508 |
+
echo $quote_id;
|
509 |
+
?>" id="quoteid" />
|
510 |
+
<?php
|
511 |
+
$current_freight_user = Mage::getStoreConfig('carriers/freightcenter/dest_loctype');
|
512 |
+
$CarrierCode = Mage::getStoreConfig('carriers/freightcenter/positions');
|
513 |
+
$Carrierdisplay = Mage::getStoreConfig('carriers/freightcenter/carrier_display');
|
514 |
+
$markup = Mage::getStoreConfig('carriers/freightcenter/markup');
|
515 |
+
$markup_type = Mage::getStoreConfig('carriers/freightcenter/markup_type');
|
516 |
+
$markup_price = Mage::getStoreConfig('carriers/freightcenter/markup_price');
|
517 |
+
$CarrierCode = explode(",", $CarrierCode);
|
518 |
+
//echo count($CarrierCode);
|
519 |
+
/* if( $Carrierdisplay > count($CarrierCode))
|
520 |
+
{
|
521 |
+
$Carrierdisplay = count($CarrierCode);
|
522 |
+
} */
|
523 |
+
$carriercount = count($CarrierCode);
|
524 |
+
?>
|
525 |
+
<div id="carrier_radio_select_div"></div>
|
526 |
+
<!--<p style="font-size: 15px; font-weight: 600;">Select Carrier</p>-->
|
527 |
+
<?php
|
528 |
+
for ($modz = 0; $modz < $carriercount; $modz++) {
|
529 |
+
|
530 |
+
$carrier_multi_rate .= " <Carrier>
|
531 |
+
<RatesRequest_Carrier>
|
532 |
+
<CarrierCode>" . $CarrierCode[$modz] . "</CarrierCode>
|
533 |
+
<services />
|
534 |
+
</RatesRequest_Carrier>
|
535 |
+
</Carrier>";
|
536 |
+
}
|
537 |
+
/* echo $carrier_multi_rate;
|
538 |
+
die(); */
|
539 |
+
$crra = explode(",", $current_freight_user);
|
540 |
+
if (count($crra) < 0) {
|
541 |
+
} else {
|
542 |
+
?>
|
543 |
+
<div>
|
544 |
+
<!-- <h4>Freight Cost</h4>-->
|
545 |
+
<h4>Select Location Type</h4>
|
546 |
+
<select class="required-entry required-entry select" onchange="getrate_again_one(this.value,'<?php
|
547 |
+
echo $allids;
|
548 |
+
?>','<?php
|
549 |
+
echo $address;
|
550 |
+
?>','<?php
|
551 |
+
echo $quote_id;
|
552 |
+
?>');" name="location_type" id="location_type">
|
553 |
+
<?php
|
554 |
+
foreach ($crra as $crr) {
|
555 |
+
?>
|
556 |
+
<option value="<?php
|
557 |
+
echo str_replace(' ', '', $crr);
|
558 |
+
?>">
|
559 |
+
<?php
|
560 |
+
echo $crr;
|
561 |
+
?>
|
562 |
+
</option>
|
563 |
+
<?php
|
564 |
+
}
|
565 |
+
?>
|
566 |
+
</select>
|
567 |
+
</div>
|
568 |
+
<?php
|
569 |
+
}
|
570 |
+
?>
|
571 |
+
<div style="margin-top: 10px">
|
572 |
+
<!-- <h4>Select Extra Services</h4>-->
|
573 |
+
<div class="accessories">
|
574 |
+
<?php //echo $crra['0'];
|
575 |
+
$new_doc_type = str_replace(' ', '', $crra['0']);?>
|
576 |
+
<?php if($crra['0'] == 'Residential') { ?>
|
577 |
+
<input onclick="getaccessRates();" id="resident1" type="checkbox" value="DEST_INSIDE_DEL" /><label for="resident1" class="access_class">Threshold Delivery</label>
|
578 |
+
<?php } else if($crra['0'] == 'Business With Dock or Forklift') {?>
|
579 |
+
<input onclick="getaccessRates();" id="buswith1" type="checkbox" value="DEST_NOTIFY" /><label for="buswith1" class="access_class">Call before Delivery</label>
|
580 |
+
<input onclick="getaccessRates();" id="buswith2" type="checkbox" value="DEST_INSIDE_DEL" /><label for="buswith2" class="access_class">Threshold Delivery</label>
|
581 |
+
<input onclick="getaccessRates();" id="buswith3" type="checkbox" value="DEST_LIMITED_DEL" /><label for="buswith3" class="access_class">Limited Access Delivery</label>
|
582 |
+
|
583 |
+
<?php } else if($crra['0'] == 'Business Without Dock or Forklift') { ?>
|
584 |
+
<input onclick="getaccessRates();" id="buswithout1" type="checkbox" value="DEST_NOTIFY" /><label for="buswithout1" class="access_class">Call before Delivery</label>
|
585 |
+
<input onclick="getaccessRates();" id="buswithout2" type="checkbox" value="DEST_INSIDE_DEL" /><label for="buswithout2" class="access_class">Threshold Delivery</label>
|
586 |
+
<input onclick="getaccessRates();" id="buswithout4" type="checkbox" value="DEST_LIMITED_DEL" /><label for="buswithout4" class="access_class">Limited Access Delivery</label>
|
587 |
+
|
588 |
+
<?php } else if($crra['0'] == 'Construction Site') { ?>
|
589 |
+
<input onclick="getaccessRates();" id="const1" type="checkbox" value="DEST_LIFT_GATE" /><label for="const1" class="access_class">Lift Gate at Delivery Point</label>
|
590 |
+
|
591 |
+
<?php } else if($crra['0'] == 'Convention Center or Tradeshow') { ?>
|
592 |
+
<input onclick="getaccessRates();" id="convent1" type="checkbox" value="DEST_LIFT_GATE" /><label for="convent1" class="access_class">Lift Gate at Delivery Point</label>
|
593 |
+
|
594 |
+
<?php } else if($crra['0'] == 'Terminal') { ?>
|
595 |
+
<input onclick="getaccessRates();" id="terminal1" type="checkbox" value="DEST_NOTIFY" /><label for="terminal1" class="access_class">Call before Delivery</label>
|
596 |
+
|
597 |
+
<?php } ?>
|
598 |
+
<!-- <input onclick="apicallrateRates();" id="resident1" type="checkbox" value="DEST_INSIDE_DEL" />
|
599 |
+
<label for="resident1" class="access_class">Threshold Delivery</label>
|
600 |
+
<input onclick="getaccessRates();" id="resident2" type="checkbox" value="DEST_LIFT_GATE" />
|
601 |
+
<label for="resident2" class="access_class">Lift Gate at Delivery Point</label>-->
|
602 |
+
</div>
|
603 |
+
</div>
|
604 |
+
<hr />
|
605 |
+
<h4>Freight Shipping</h4>
|
606 |
+
<?php
|
607 |
+
}
|
608 |
+
$attribute_f = Mage::getModel('eav/config')->getAttribute('catalog_product', 'freight_class');
|
609 |
+
foreach ($attribute_f->getSource()->getAllOptions(true, true) as $opt_menuf) {
|
610 |
+
$f_attribute[$opt_menuf['value']] = $opt_menuf['label'];
|
611 |
+
}
|
612 |
+
|
613 |
+
$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'packaging_type');
|
614 |
+
foreach ($attribute->getSource()->getAllOptions(true, true) as $opt_menu1) {
|
615 |
+
$m_attribute[$opt_menu1['value']] = $opt_menu1['label'];
|
616 |
+
}
|
617 |
+
|
618 |
+
$attribute1 = Mage::getModel('eav/config')->getAttribute('catalog_product', 'origin_warehouse');
|
619 |
+
foreach ($attribute1->getSource()->getAllOptions(true, true) as $opt_menu) {
|
620 |
+
$m1_attribute[$opt_menu['value']] = $opt_menu['label'];
|
621 |
+
}
|
622 |
+
|
623 |
+
/* combine products by warehouse */
|
624 |
+
|
625 |
+
$ware_array = array();
|
626 |
+
$new_doc_type = str_replace(' ', '', $crra['0']);
|
627 |
+
foreach ($myarray as $proarray) {
|
628 |
+
$warehouseid = $m1_attribute[$proarray['origin_warehouse']];
|
629 |
+
|
630 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
631 |
+
$ware_query = "SELECT * FROM `brst_ship_warehouses` WHERE short_name = '$warehouseid'";
|
632 |
+
$ware_results = $connection->fetchAll($ware_query);
|
633 |
+
if ($ware_results != NULL) {
|
634 |
+
$warehousename = $ware_results[0]['short_name'];
|
635 |
+
}
|
636 |
+
|
637 |
+
if (array_key_exists($warehousename, $ware_array)) {
|
638 |
+
array_push($ware_array[$warehousename], $proarray);
|
639 |
+
} else {
|
640 |
+
$ware_array[$warehousename] = array(
|
641 |
+
$proarray
|
642 |
+
);
|
643 |
+
}
|
644 |
+
}
|
645 |
+
//echo '<pre>'; print_r($ware_array);echo '</pre>'; exit;
|
646 |
+
$ware_count = count($ware_array);
|
647 |
+
$discount_price = $discount_price / $ware_count;
|
648 |
+
$markup_price = $markup_price / $ware_count;
|
649 |
+
foreach ($ware_array as $key => $value) {
|
650 |
+
//$start = 1;
|
651 |
+
$pro_item = '';
|
652 |
+
$pro_names = '';
|
653 |
+
foreach ($value as $mainarray) {
|
654 |
+
$product_id = $mainarray['entity_id'];
|
655 |
+
$product_description = str_replace(' ', '', $mainarray['description']);
|
656 |
+
$product_name = $mainarray['name'];
|
657 |
+
$freight_length = $mainarray['freight_length'];
|
658 |
+
$freight_width = $mainarray['freight_width'];
|
659 |
+
$freight_height = $mainarray['freight_height'];
|
660 |
+
$nmfc = $mainarray['nmfc'];
|
661 |
+
$quantity = $cart_products[$product_id];
|
662 |
+
$weight = ($mainarray['weight'] * $quantity);
|
663 |
+
|
664 |
+
$freight_class = $f_attribute[$mainarray['freight_class']];
|
665 |
+
//$packaging_type = $m_attribute[$mainarray['packaging_type']];
|
666 |
+
$ware_id = $m1_attribute[$mainarray['origin_warehouse']];
|
667 |
+
|
668 |
+
$resource = Mage::getSingleton('core/resource');
|
669 |
+
$readConnection = $resource->getConnection('core_read');
|
670 |
+
$tableNamep = $resource->getTableName('brst_ship_warehouses');
|
671 |
+
$queryp = "SELECT * FROM $tableNamep WHERE short_name = '$ware_id' LIMIT 10";
|
672 |
+
|
673 |
+
$results = $readConnection->fetchAll($queryp);
|
674 |
+
//echo "<pre>";print_r($results);exit;
|
675 |
+
foreach ($results as $ware_result) {
|
676 |
+
//$warehouse_name = $ware_result['short_name'];
|
677 |
+
$warehouse_location_type = str_replace(' ', '', $ware_result['location_type']);
|
678 |
+
$accessorials = $ware_result['accessorials'];
|
679 |
+
$accessorials = explode(',', $accessorials);
|
680 |
+
//print_r($accessorials);
|
681 |
+
$accessorialsdisplay = count($accessorials);
|
682 |
+
$print_accessorials = '';
|
683 |
+
for ($modz = 0; $modz < $accessorialsdisplay; $modz++) {
|
684 |
+
|
685 |
+
//$print_accessorials ="<p>".$accessorials[$modz]."</p>"
|
686 |
+
if ($accessorials[$modz] == '1') {
|
687 |
+
$print_accessorials .= "<string>ORIGIN_LIFT_GATE</string>";
|
688 |
+
}
|
689 |
+
if ($accessorials[$modz] == '2') {
|
690 |
+
$print_accessorials .= "<string>ORIGIN_LIMITED_PU</string>";
|
691 |
+
}
|
692 |
+
if ($accessorials[$modz] == '3') {
|
693 |
+
$print_accessorials .= "<string>ORIGIN_INSIDE_PU</string>";
|
694 |
+
}
|
695 |
+
if ($accessorials[$modz] == '4') {
|
696 |
+
$print_accessorials .= "<string>ORIGIN_CALL_FOR_APPT</string>";
|
697 |
+
}
|
698 |
+
}
|
699 |
+
//echo $print_accessorials;
|
700 |
+
?>
|
701 |
+
<input type="hidden" value="<?php
|
702 |
+
echo $warehouse_location_type;
|
703 |
+
?>" id="hidden_warehouse_location" />
|
704 |
+
<?php
|
705 |
+
$warehouse_postcode = $ware_result['cmpny_postcode'];
|
706 |
+
$city = $ware_result['city'];
|
707 |
+
$state = $ware_result['state'];
|
708 |
+
//$location_type = $ware_result['location_type'];
|
709 |
+
?>
|
710 |
+
<input type="hidden" value="<?php
|
711 |
+
echo $warehouse_postcode;
|
712 |
+
?>" id="warehouse_postcode" />
|
713 |
+
<?php
|
714 |
+
}
|
715 |
+
|
716 |
+
$pro_names .= '<li>' . $product_name . '</li>';
|
717 |
+
|
718 |
+
$pro_item .= '<RatesRequest_Item>
|
719 |
+
<Description>' . $product_description . '</Description>
|
720 |
+
<PackagingCode>Palletized</PackagingCode>
|
721 |
+
<Quantity>' . $quantity . '</Quantity>
|
722 |
+
<LinearFeet>0</LinearFeet>
|
723 |
+
<Dimensions>
|
724 |
+
<Length>' . $freight_length . '</Length>
|
725 |
+
<Width>' . $freight_width . '</Width>
|
726 |
+
<Height>' . $freight_height . '</Height>
|
727 |
+
<UnitOfMeasure>IN</UnitOfMeasure>
|
728 |
+
</Dimensions>
|
729 |
+
<FreightClass>' . $freight_class . '</FreightClass>
|
730 |
+
<Weight>
|
731 |
+
<WeightAmt>' . $weight . '</WeightAmt>
|
732 |
+
<UnitOfMeasure>LBS</UnitOfMeasure>
|
733 |
+
</Weight>
|
734 |
+
<Nmfc>' . $nmfc . '</Nmfc>
|
735 |
+
</RatesRequest_Item>';
|
736 |
+
}
|
737 |
+
?>
|
738 |
+
<div class="freight_box" id="freight_box<?php
|
739 |
+
echo $product_id;
|
740 |
+
?>">
|
741 |
+
<?php //if($start == 1) {
|
742 |
+
?>
|
743 |
+
<div id="fre_ship">
|
744 |
+
<p>Choose a carrier for items shipping from
|
745 |
+
<?php
|
746 |
+
echo $city;
|
747 |
+
?>
|
748 |
+
,
|
749 |
+
<?php
|
750 |
+
echo $state;
|
751 |
+
?>
|
752 |
+
:</p>
|
753 |
+
</div>
|
754 |
+
<?php //}
|
755 |
+
?>
|
756 |
+
<ul>
|
757 |
+
|
758 |
+
<?php
|
759 |
+
echo $pro_names;
|
760 |
+
?>
|
761 |
+
|
762 |
+
</ul>
|
763 |
+
<div id="ajax_response<?php
|
764 |
+
echo $product_id;
|
765 |
+
?>">
|
766 |
+
<?php
|
767 |
+
$xml = '<?xml version="1.0" encoding="utf-8"?>
|
768 |
+
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
|
769 |
+
<soap12:Body>
|
770 |
+
<GetRates xmlns="http://freightcenter.com/API/V04/">
|
771 |
+
<request>
|
772 |
+
<LicenseKey>3BDA740C-FF39-4BDC-AB49-B0A3C08E23B4</LicenseKey>
|
773 |
+
<Username>'.$freightuser.'</Username>
|
774 |
+
<Password>'.$freightpwd.'</Password>
|
775 |
+
<OriginPostalCode>' . $warehouse_postcode . '</OriginPostalCode>
|
776 |
+
<OriginLocationType>' . $warehouse_location_type . '</OriginLocationType>
|
777 |
+
<DestinationPostalCode>' . $address . '</DestinationPostalCode>
|
778 |
+
<DestinationLocationType>'.$new_doc_type.'</DestinationLocationType>
|
779 |
+
<Items>' . $pro_item . '</Items>
|
780 |
+
<Accessorials>' . $print_accessorials . '</Accessorials>
|
781 |
+
<Filters>
|
782 |
+
<Mode>LTL</Mode>
|
783 |
+
<IncludeWhiteGlove>false</IncludeWhiteGlove>
|
784 |
+
<IncludeMotorcycleRates>false</IncludeMotorcycleRates>
|
785 |
+
<CarrierFilter>
|
786 |
+
<CarrierFilterType>INCLUDE</CarrierFilterType>
|
787 |
+
' . $carrier_multi_rate . '
|
788 |
+
</CarrierFilter>
|
789 |
+
</Filters>
|
790 |
+
</request>
|
791 |
+
</GetRates>
|
792 |
+
</soap12:Body>
|
793 |
+
</soap12:Envelope>';
|
794 |
+
|
795 |
+
$apiurl = $apirateurl;
|
796 |
+
|
797 |
+
$headers = array(
|
798 |
+
"POST /V04/rates.asmx HTTP/1.1",
|
799 |
+
"Host: " . $host . "",
|
800 |
+
"Content-Type: text/xml; charset=utf-8",
|
801 |
+
"Content-length: " . strlen($xml)
|
802 |
+
);
|
803 |
+
//print_r($xml);
|
804 |
+
|
805 |
+
/* send curl request to get active carriers */
|
806 |
+
$soap_do = curl_init();
|
807 |
+
curl_setopt($soap_do, CURLOPT_URL, $apiurl);
|
808 |
+
curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true);
|
809 |
+
curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false);
|
810 |
+
curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false);
|
811 |
+
curl_setopt($soap_do, CURLOPT_POST, true);
|
812 |
+
curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 0);
|
813 |
+
curl_setopt($soap_do, CURLOPT_TIMEOUT, 400);
|
814 |
+
curl_setopt($soap_do, CURLOPT_HTTPHEADER, $headers);
|
815 |
+
curl_setopt($soap_do, CURLOPT_POSTFIELDS, $xml);
|
816 |
+
|
817 |
+
$result = curl_exec($soap_do);
|
818 |
+
|
819 |
+
curl_close($soap_do);
|
820 |
+
|
821 |
+
$p = xml_parser_create();
|
822 |
+
xml_parse_into_struct($p, $result, $vals, $index);
|
823 |
+
xml_parser_free($p);
|
824 |
+
//echo '<pre>'; print_r($vals);
|
825 |
+
$vals['5']['value'];
|
826 |
+
if ($vals['5']['value'] == 'ERROR') {
|
827 |
+
?>
|
828 |
+
<div>
|
829 |
+
<input type="radio" style="display:none" class="ajax" id="s_method_flatrate_flatrate" value="" name="shipping_method">
|
830 |
+
<p> There was a problem with the freight. Do you want to check-out with only non-freight products? </p>
|
831 |
+
<button onclick="removefreight('yes')" class="button" title="Remove Freight Products" type="button"><span><span>Yes</span></span></button>
|
832 |
+
</div>
|
833 |
+
<?php
|
834 |
+
} else if ($vals['5']['value'] == 'WARNING') {
|
835 |
+
?>
|
836 |
+
<div>
|
837 |
+
<input type="radio" style="display:none" class="ajax" id="s_method_flatrate_flatrate" value="" name="shipping_method">
|
838 |
+
<p> There was a problem with the freight. Do you want to check-out with only non-freight products? </p>
|
839 |
+
<button onclick="removefreight('yes')" class="button" title="Remove Freight Products" type="button"><span><span>Yes</span></span></button>
|
840 |
+
</div>
|
841 |
+
<?php
|
842 |
+
} else if (empty($vals)) {
|
843 |
+
?>
|
844 |
+
<div>
|
845 |
+
<input type="radio" style="display:none" class="ajax" id="s_method_flatrate_flatrate" value="" name="shipping_method">
|
846 |
+
<p> There was a problem with the freight. Do you want to check-out with only non-freight products? </p>
|
847 |
+
<button onclick="removefreight('yes')" class="button" title="Remove Freight Products" type="button"><span><span>Yes</span></span></button>
|
848 |
+
</div>
|
849 |
+
<?php
|
850 |
+
} else {
|
851 |
+
|
852 |
+
$xmlResponseArray = array();
|
853 |
+
foreach ($vals as $charges) {
|
854 |
+
|
855 |
+
if (in_array("TOTALCHARGE", $charges)) {
|
856 |
+
$xmlResponseArray['TOTALCHARGE'][] = $charges['value'];
|
857 |
+
}
|
858 |
+
if (in_array("SERVICENAME", $charges)) {
|
859 |
+
$xmlResponseArray['SERVICENAME'][] = $charges['value'];
|
860 |
+
}
|
861 |
+
if (in_array("SERVICEDAYS", $charges)) {
|
862 |
+
$xmlResponseArray['SERVICEDAYS'][] = $charges['value'];
|
863 |
+
}
|
864 |
+
if (in_array("RATEID", $charges)) {
|
865 |
+
$xmlResponseArray['RATEID'][] = $charges['value'];
|
866 |
+
}
|
867 |
+
}
|
868 |
+
$xmlResponse = array();
|
869 |
+
$countedCharges = count($xmlResponseArray['TOTALCHARGE']);
|
870 |
+
|
871 |
+
//echo
|
872 |
+
if ($subtotal > $discount_amount) {
|
873 |
+
$Carrierd = 1;
|
874 |
+
} else {
|
875 |
+
$Carrierd = $Carrierdisplay;
|
876 |
+
}
|
877 |
+
for ($j = 0; $j < $Carrierd; $j++) {
|
878 |
+
$xmlResponse[$j][] = $xmlResponseArray['TOTALCHARGE'][$j];
|
879 |
+
$xmlResponse[$j][] = $xmlResponseArray['SERVICENAME'][$j];
|
880 |
+
$xmlResponse[$j][] = $xmlResponseArray['SERVICEDAYS'][$j];
|
881 |
+
$xmlResponse[$j][] = $xmlResponseArray['RATEID'][$j];
|
882 |
+
}
|
883 |
+
?>
|
884 |
+
<!--<h4>Select a carrier rate</h4>-->
|
885 |
+
<?php
|
886 |
+
// echo '<pre>'; print_r($xmlResponse);
|
887 |
+
foreach ($xmlResponse as $xmlResponse2) {
|
888 |
+
$total_charge = $xmlResponse2[0];
|
889 |
+
$carriers_value = $xmlResponse2[1];
|
890 |
+
$business_day = $xmlResponse2[2];
|
891 |
+
$RATEID = $xmlResponse2[3];
|
892 |
+
|
893 |
+
if ($total_charge == '') {
|
894 |
+
?>
|
895 |
+
<!--<div><p>
|
896 |
+
“There a problem with the freight. Do you want to check-out with only non-freight products?”
|
897 |
+
Please click...
|
898 |
+
</p>
|
899 |
+
<button onclick="removefreight('yes')" class="button" title="Remove Freight Products" type="button"><span><span>Yes</span></span></button></div> -->
|
900 |
+
|
901 |
+
<?php
|
902 |
+
} else {
|
903 |
+
|
904 |
+
/* if($subtotal > $discount_amount){
|
905 |
+
//echo $total_charge;
|
906 |
+
if($total_charge < $discount_price){
|
907 |
+
} else{
|
908 |
+
$total_charge = $discount_price;
|
909 |
+
}
|
910 |
+
} */
|
911 |
+
//echo $total_charge;
|
912 |
+
if ($markup == 'none') {
|
913 |
+
$gettotal = $total_charge;
|
914 |
+
if ($subtotal > $discount_amount) {
|
915 |
+
//echo $total_charge;
|
916 |
+
if ($gettotal < $discount_price) {
|
917 |
+
} else {
|
918 |
+
$gettotal = $discount_price;
|
919 |
+
}
|
920 |
+
}
|
921 |
+
|
922 |
+
}
|
923 |
+
|
924 |
+
if ($markup == 'markup') {
|
925 |
+
$gettotal = $total_charge;
|
926 |
+
if ($markup_type == 'percent') {
|
927 |
+
$markup_price = Mage::getStoreConfig('carriers/freightcenter/markup_price');
|
928 |
+
$gettotal_pr = ($gettotal * $markup_price) / 100;
|
929 |
+
$gettotal = $gettotal + $gettotal_pr;
|
930 |
+
} else {
|
931 |
+
//$markup_price = Mage::getStoreConfig('carriers/freightcenter/markup_price');
|
932 |
+
$gettotal = $gettotal + $markup_price;
|
933 |
+
}
|
934 |
+
|
935 |
+
if ($subtotal > $discount_amount) {
|
936 |
+
//echo $total_charge;
|
937 |
+
if ($gettotal < $discount_price) {
|
938 |
+
} else {
|
939 |
+
$gettotal = $discount_price;
|
940 |
+
}
|
941 |
+
}
|
942 |
+
}
|
943 |
+
|
944 |
+
if ($markup == 'discount') {
|
945 |
+
$gettotal = $total_charge;
|
946 |
+
if ($markup_type == 'percent') {
|
947 |
+
$markup_price = Mage::getStoreConfig('carriers/freightcenter/markup_price');
|
948 |
+
$gettotal_pr = ($gettotal * $markup_price) / 100;
|
949 |
+
$gettotal = $gettotal - $gettotal_pr;
|
950 |
+
} else {
|
951 |
+
//$markup_price = Mage::getStoreConfig('carriers/freightcenter/markup_price');
|
952 |
+
$gettotal = $gettotal - $markup_price;
|
953 |
+
}
|
954 |
+
if ($subtotal > $discount_amount) {
|
955 |
+
//echo $total_charge;
|
956 |
+
if ($gettotal < $discount_price) {
|
957 |
+
} else {
|
958 |
+
$gettotal = $discount_price;
|
959 |
+
}
|
960 |
+
}
|
961 |
+
|
962 |
+
|
963 |
+
}
|
964 |
+
|
965 |
+
?>
|
966 |
+
<div style="display: none; height: 35px; margin-top: 20px;" class="pls-wait"> <span id="loader_loctype<?php
|
967 |
+
echo $product_id;
|
968 |
+
?>"> <img class="v-middle" title="Loading carrier rates..." alt="Loading carrier rates..." src="<?php
|
969 |
+
echo $this->getSkinUrl('images/opc-ajax-loader.gif');
|
970 |
+
?>"> </span> <span>Loading Carrier Rates</span> </div>
|
971 |
+
<div class="ajax-result" id="ajax_result<?php
|
972 |
+
print $product_id;
|
973 |
+
?>">
|
974 |
+
<table>
|
975 |
+
<tr>
|
976 |
+
<td width="20"><input type="radio" class="ajax" value="ajax_response" name="shipping<?php
|
977 |
+
print $product_id;
|
978 |
+
?>" onclick="ajaxcallnew('<?php
|
979 |
+
print $product_id;
|
980 |
+
?>','<?php
|
981 |
+
print $gettotal;
|
982 |
+
?>','<?php
|
983 |
+
echo $quote_id;
|
984 |
+
?>','<?php
|
985 |
+
echo $carriers_value;
|
986 |
+
?>','<?php
|
987 |
+
echo $RATEID;
|
988 |
+
?>',<?php
|
989 |
+
echo $business_day;
|
990 |
+
?>,'<?php
|
991 |
+
echo $total_charge;
|
992 |
+
?>');" id="ajax<?php
|
993 |
+
print $product_id;
|
994 |
+
?>" /></td>
|
995 |
+
<td><label for="ajax<?php
|
996 |
+
print $product_id;
|
997 |
+
?>"><span class="car_show">
|
998 |
+
<?php
|
999 |
+
echo $carriers_value;
|
1000 |
+
?>
|
1001 |
+
</span> <span style="display:none;" id="apply_rate<?php
|
1002 |
+
echo $product_id;
|
1003 |
+
?>"> <img class="v-middle" title="Applying carrier rate..." alt="Applying carrier rate..." src="<?php
|
1004 |
+
echo $this->getSkinUrl('images/opc-ajax-loader.gif');
|
1005 |
+
?>" /> </span></label>
|
1006 |
+
<br/>
|
1007 |
+
Estimated Transit Time:
|
1008 |
+
<?php
|
1009 |
+
echo $business_day;
|
1010 |
+
?>
|
1011 |
+
Business days
|
1012 |
+
<?php
|
1013 |
+
if ($gettotal < $total_charge) {
|
1014 |
+
?>
|
1015 |
+
</br>
|
1016 |
+
Cost: $
|
1017 |
+
<?php
|
1018 |
+
print $total_char = number_format($total_charge, 2, '.', ',');
|
1019 |
+
?>
|
1020 |
+
</br>
|
1021 |
+
Discount: -$
|
1022 |
+
<?php
|
1023 |
+
$discount_get = $total_charge - $gettotal;
|
1024 |
+
echo $discount_get = number_format($discount_get, 2, '.', ',');
|
1025 |
+
|
1026 |
+
?>
|
1027 |
+
<?php
|
1028 |
+
}
|
1029 |
+
?>
|
1030 |
+
</br>
|
1031 |
+
You Pay: $
|
1032 |
+
<?php
|
1033 |
+
echo $gettot = number_format($gettotal, 2, '.', ',');
|
1034 |
+
?></td>
|
1035 |
+
</tr>
|
1036 |
+
</table>
|
1037 |
+
<div style="clear:both;height:16px;"></div>
|
1038 |
+
</div>
|
1039 |
+
<?php
|
1040 |
+
}
|
1041 |
+
}
|
1042 |
+
}
|
1043 |
+
?>
|
1044 |
+
</div>
|
1045 |
+
</div>
|
1046 |
+
<?php
|
1047 |
+
}
|
1048 |
+
if ($non_freight != NULL) {
|
1049 |
+
?>
|
1050 |
+
<hr />
|
1051 |
+
<div class="freight_box">
|
1052 |
+
<h3>Parcel (Non-Freight) Shipping</h3>
|
1053 |
+
<p>The following items do not require freight shipping. These items ship via parcel providers:</p>
|
1054 |
+
<ul>
|
1055 |
+
<?php
|
1056 |
+
foreach ($non_freight as $non) {
|
1057 |
+
?>
|
1058 |
+
<li>
|
1059 |
+
<?php
|
1060 |
+
echo $non['name'];
|
1061 |
+
?>
|
1062 |
+
</li>
|
1063 |
+
<?php
|
1064 |
+
}
|
1065 |
+
?>
|
1066 |
+
</ul>
|
1067 |
+
</div>
|
1068 |
+
<?php
|
1069 |
+
}
|
1070 |
+
?>
|
1071 |
+
</div>
|
1072 |
+
<?php
|
1073 |
+
}
|
1074 |
+
} else {
|
1075 |
+
?>
|
1076 |
+
<div class="freight_ship" <?php
|
1077 |
+
echo $freight_box;
|
1078 |
+
?>>
|
1079 |
+
<?php
|
1080 |
+
if ($myarray != NULL) {
|
1081 |
+
?>
|
1082 |
+
<input type="hidden" value="<?php
|
1083 |
+
echo $this->getBaseUrl();
|
1084 |
+
?>" id="baseurl" />
|
1085 |
+
<input type="hidden" value="<?php
|
1086 |
+
echo $this->getSkinUrl('images/opc-ajax-loader.gif');
|
1087 |
+
?>" id="loader_url" />
|
1088 |
+
<input type="hidden" value="<?php
|
1089 |
+
echo $allids;
|
1090 |
+
?>" id="freight_ids" />
|
1091 |
+
<input type="hidden" value="<?php
|
1092 |
+
echo $address;
|
1093 |
+
?>" id="post_address" />
|
1094 |
+
<input type="hidden" value="<?php
|
1095 |
+
echo $quote_id;
|
1096 |
+
?>" id="quoteid" />
|
1097 |
+
<?php
|
1098 |
+
$current_freight_user = Mage::getStoreConfig('carriers/freightcenter/dest_loctype');
|
1099 |
+
$CarrierCode = Mage::getStoreConfig('carriers/freightcenter/positions');
|
1100 |
+
$Carrierdisplay = Mage::getStoreConfig('carriers/freightcenter/carrier_display');
|
1101 |
+
$markup = Mage::getStoreConfig('carriers/freightcenter/markup');
|
1102 |
+
$markup_type = Mage::getStoreConfig('carriers/freightcenter/markup_type');
|
1103 |
+
$markup_price = Mage::getStoreConfig('carriers/freightcenter/markup_price');
|
1104 |
+
$CarrierCode = explode(",", $CarrierCode);
|
1105 |
+
//echo count($CarrierCode);
|
1106 |
+
/* if( $Carrierdisplay > count($CarrierCode))
|
1107 |
+
{
|
1108 |
+
$Carrierdisplay = count($CarrierCode);
|
1109 |
+
} */
|
1110 |
+
$carriercount = count($CarrierCode);
|
1111 |
+
?>
|
1112 |
+
<div id="carrier_radio_select_div"></div>
|
1113 |
+
<!--<p style="font-size: 15px; font-weight: 600;">Select Carrier</p>-->
|
1114 |
+
<?php
|
1115 |
+
for ($modz = 0; $modz < $carriercount; $modz++) {
|
1116 |
+
|
1117 |
+
$carrier_multi_rate .= " <Carrier>
|
1118 |
+
<RatesRequest_Carrier>
|
1119 |
+
<CarrierCode>" . $CarrierCode[$modz] . "</CarrierCode>
|
1120 |
+
<services />
|
1121 |
+
</RatesRequest_Carrier>
|
1122 |
+
</Carrier>";
|
1123 |
+
}
|
1124 |
+
//echo $carrier_multi_rate;
|
1125 |
+
$crra = explode(",", $current_freight_user);
|
1126 |
+
if (count($crra) < 0) {
|
1127 |
+
} else {
|
1128 |
+
?>
|
1129 |
+
<div>
|
1130 |
+
<!-- <h4>Freight Cost</h4>-->
|
1131 |
+
<h4>Select Location Type</h4>
|
1132 |
+
<select class="required-entry required-entry select" onchange="getrate_again(this.value,'<?php
|
1133 |
+
echo $allids;
|
1134 |
+
?>','<?php
|
1135 |
+
echo $address;
|
1136 |
+
?>','<?php
|
1137 |
+
echo $quote_id;
|
1138 |
+
?>');" name="location_type" id="location_type">
|
1139 |
+
<?php
|
1140 |
+
foreach ($crra as $crr) {
|
1141 |
+
?>
|
1142 |
+
<option value="<?php
|
1143 |
+
echo str_replace(' ', '', $crr);
|
1144 |
+
?>">
|
1145 |
+
<?php
|
1146 |
+
echo $crr;
|
1147 |
+
?>
|
1148 |
+
</option>
|
1149 |
+
<?php
|
1150 |
+
}
|
1151 |
+
?>
|
1152 |
+
</select>
|
1153 |
+
</div>
|
1154 |
+
<?php
|
1155 |
+
}
|
1156 |
+
?>
|
1157 |
+
<div style="margin-top: 10px">
|
1158 |
+
<!-- <h4>Select Extra Services</h4>-->
|
1159 |
+
<div class="accessories">
|
1160 |
+
<?php //echo $crra['0'];
|
1161 |
+
$new_doc_type = str_replace(' ', '', $crra['0']); ?>
|
1162 |
+
<?php if($crra['0'] == 'Residential') { ?>
|
1163 |
+
<input onclick="getaccessRates();" id="resident1" type="checkbox" value="DEST_INSIDE_DEL" /><label for="resident1" class="access_class">Threshold Delivery</label>
|
1164 |
+
<?php } else if($crra['0'] == 'Business With Dock or Forklift') {?>
|
1165 |
+
<input onclick="getaccessRates();" id="buswith1" type="checkbox" value="DEST_NOTIFY" /><label for="buswith1" class="access_class">Call before Delivery</label>
|
1166 |
+
<input onclick="getaccessRates();" id="buswith2" type="checkbox" value="DEST_INSIDE_DEL" /><label for="buswith2" class="access_class">Threshold Delivery</label>
|
1167 |
+
<input onclick="getaccessRates();" id="buswith3" type="checkbox" value="DEST_LIMITED_DEL" /><label for="buswith3" class="access_class">Limited Access Delivery</label>
|
1168 |
+
|
1169 |
+
<?php } else if($crra['0'] == 'Business Without Dock or Forklift') { ?>
|
1170 |
+
<input onclick="getaccessRates();" id="buswithout1" type="checkbox" value="DEST_NOTIFY" /><label for="buswithout1" class="access_class">Call before Delivery</label>
|
1171 |
+
<input onclick="getaccessRates();" id="buswithout2" type="checkbox" value="DEST_INSIDE_DEL" /><label for="buswithout2" class="access_class">Threshold Delivery</label>
|
1172 |
+
<input onclick="getaccessRates();" id="buswithout4" type="checkbox" value="DEST_LIMITED_DEL" /><label for="buswithout4" class="access_class">Limited Access Delivery</label>
|
1173 |
+
|
1174 |
+
<?php } else if($crra['0'] == 'Construction Site') { ?>
|
1175 |
+
<input onclick="getaccessRates();" id="const1" type="checkbox" value="DEST_LIFT_GATE" /><label for="const1" class="access_class">Lift Gate at Delivery Point</label>
|
1176 |
+
|
1177 |
+
<?php } else if($crra['0'] == 'Convention Center or Tradeshow') { ?>
|
1178 |
+
<input onclick="getaccessRates();" id="convent1" type="checkbox" value="DEST_LIFT_GATE" /><label for="convent1" class="access_class">Lift Gate at Delivery Point</label>
|
1179 |
+
|
1180 |
+
<?php } else if($crra['0'] == 'Terminal') { ?>
|
1181 |
+
<input onclick="getaccessRates();" id="terminal1" type="checkbox" value="DEST_NOTIFY" /><label for="terminal1" class="access_class">Call before Delivery</label>
|
1182 |
+
|
1183 |
+
<?php } ?>
|
1184 |
+
<!-- <input onclick="apicallrateRates();" id="resident1" type="checkbox" value="DEST_INSIDE_DEL" />
|
1185 |
+
<label for="resident1" class="access_class">Threshold Delivery</label>
|
1186 |
+
<input onclick="getaccessRates();" id="resident2" type="checkbox" value="DEST_LIFT_GATE" />
|
1187 |
+
<label for="resident2" class="access_class">Lift Gate at Delivery Point</label>-->
|
1188 |
+
</div>
|
1189 |
+
</div>
|
1190 |
+
<hr />
|
1191 |
+
<h4>Freight Shipping</h4>
|
1192 |
+
<?php
|
1193 |
+
}
|
1194 |
+
$attribute_f = Mage::getModel('eav/config')->getAttribute('catalog_product', 'freight_class');
|
1195 |
+
foreach ($attribute_f->getSource()->getAllOptions(true, true) as $opt_menuf) {
|
1196 |
+
$f_attribute[$opt_menuf['value']] = $opt_menuf['label'];
|
1197 |
+
}
|
1198 |
+
|
1199 |
+
$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'packaging_type');
|
1200 |
+
foreach ($attribute->getSource()->getAllOptions(true, true) as $opt_menu1) {
|
1201 |
+
$m_attribute[$opt_menu1['value']] = $opt_menu1['label'];
|
1202 |
+
}
|
1203 |
+
|
1204 |
+
$attribute1 = Mage::getModel('eav/config')->getAttribute('catalog_product', 'origin_warehouse');
|
1205 |
+
foreach ($attribute1->getSource()->getAllOptions(true, true) as $opt_menu) {
|
1206 |
+
$m1_attribute[$opt_menu['value']] = $opt_menu['label'];
|
1207 |
+
}
|
1208 |
+
|
1209 |
+
/* combine products by warehouse */
|
1210 |
+
|
1211 |
+
$ware_array = array();
|
1212 |
+
$new_doc_type = str_replace(' ', '', $crra['0']);
|
1213 |
+
foreach ($myarray as $proarray) {
|
1214 |
+
$warehouseid = $m1_attribute[$proarray['origin_warehouse']];
|
1215 |
+
|
1216 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
1217 |
+
$ware_query = "SELECT * FROM `brst_ship_warehouses` WHERE short_name = '$warehouseid'";
|
1218 |
+
$ware_results = $connection->fetchAll($ware_query);
|
1219 |
+
if ($ware_results != NULL) {
|
1220 |
+
$warehousename = $ware_results[0]['short_name'];
|
1221 |
+
}
|
1222 |
+
|
1223 |
+
if (array_key_exists($warehousename, $ware_array)) {
|
1224 |
+
array_push($ware_array[$warehousename], $proarray);
|
1225 |
+
} else {
|
1226 |
+
$ware_array[$warehousename] = array(
|
1227 |
+
$proarray
|
1228 |
+
);
|
1229 |
+
}
|
1230 |
+
}
|
1231 |
+
//echo '<pre>'; print_r($ware_array);echo '</pre>'; exit;
|
1232 |
+
$ware_count = count($ware_array);
|
1233 |
+
$discount_price = $discount_price / $ware_count;
|
1234 |
+
$markup_price = $markup_price / $ware_count;
|
1235 |
+
foreach ($ware_array as $key => $value) {
|
1236 |
+
//$start = 1;
|
1237 |
+
$pro_item = '';
|
1238 |
+
$pro_names = '';
|
1239 |
+
foreach ($value as $mainarray) {
|
1240 |
+
$product_id = $mainarray['entity_id'];
|
1241 |
+
$product_description = str_replace(' ', '', $mainarray['description']);
|
1242 |
+
$product_name = $mainarray['name'];
|
1243 |
+
$freight_length = $mainarray['freight_length'];
|
1244 |
+
$freight_width = $mainarray['freight_width'];
|
1245 |
+
$freight_height = $mainarray['freight_height'];
|
1246 |
+
$nmfc = $mainarray['nmfc'];
|
1247 |
+
$quantity = $cart_products[$product_id];
|
1248 |
+
$weight = ($mainarray['weight'] * $quantity);
|
1249 |
+
|
1250 |
+
$freight_class = $f_attribute[$mainarray['freight_class']];
|
1251 |
+
//$packaging_type = $m_attribute[$mainarray['packaging_type']];
|
1252 |
+
$ware_id = $m1_attribute[$mainarray['origin_warehouse']];
|
1253 |
+
|
1254 |
+
$resource = Mage::getSingleton('core/resource');
|
1255 |
+
$readConnection = $resource->getConnection('core_read');
|
1256 |
+
$tableNamep = $resource->getTableName('brst_ship_warehouses');
|
1257 |
+
$queryp = "SELECT * FROM $tableNamep WHERE short_name = '$ware_id' LIMIT 10";
|
1258 |
+
|
1259 |
+
$results = $readConnection->fetchAll($queryp);
|
1260 |
+
//echo "<pre>";print_r($results);exit;
|
1261 |
+
foreach ($results as $ware_result) {
|
1262 |
+
//$warehouse_name = $ware_result['short_name'];
|
1263 |
+
$warehouse_location_type = str_replace(' ', '', $ware_result['location_type']);
|
1264 |
+
$accessorials = $ware_result['accessorials'];
|
1265 |
+
$accessorials = explode(',', $accessorials);
|
1266 |
+
//print_r($accessorials);
|
1267 |
+
$accessorialsdisplay = count($accessorials);
|
1268 |
+
$print_accessorials = '';
|
1269 |
+
for ($modz = 0; $modz < $accessorialsdisplay; $modz++) {
|
1270 |
+
|
1271 |
+
//$print_accessorials ="<p>".$accessorials[$modz]."</p>"
|
1272 |
+
if ($accessorials[$modz] == '1') {
|
1273 |
+
$print_accessorials .= "<string>ORIGIN_LIFT_GATE</string>";
|
1274 |
+
}
|
1275 |
+
if ($accessorials[$modz] == '2') {
|
1276 |
+
$print_accessorials .= "<string>ORIGIN_LIMITED_PU</string>";
|
1277 |
+
}
|
1278 |
+
if ($accessorials[$modz] == '3') {
|
1279 |
+
$print_accessorials .= "<string>ORIGIN_INSIDE_PU</string>";
|
1280 |
+
}
|
1281 |
+
if ($accessorials[$modz] == '4') {
|
1282 |
+
$print_accessorials .= "<string>ORIGIN_CALL_FOR_APPT</string>";
|
1283 |
+
}
|
1284 |
+
}
|
1285 |
+
//echo $print_accessorials;
|
1286 |
+
?>
|
1287 |
+
<input type="hidden" value="<?php
|
1288 |
+
echo $warehouse_location_type;
|
1289 |
+
?>" id="hidden_warehouse_location" />
|
1290 |
+
<?php
|
1291 |
+
$warehouse_postcode = $ware_result['cmpny_postcode'];
|
1292 |
+
$city = $ware_result['city'];
|
1293 |
+
$state = $ware_result['state'];
|
1294 |
+
//$location_type = $ware_result['location_type'];
|
1295 |
+
?>
|
1296 |
+
<input type="hidden" value="<?php
|
1297 |
+
echo $warehouse_postcode;
|
1298 |
+
?>" id="warehouse_postcode" />
|
1299 |
+
<?php
|
1300 |
+
}
|
1301 |
+
|
1302 |
+
$pro_names .= '<li>' . $product_name . '</li>';
|
1303 |
+
|
1304 |
+
$pro_item .= '<RatesRequest_Item>
|
1305 |
+
<Description>' . $product_description . '</Description>
|
1306 |
+
<PackagingCode>Palletized</PackagingCode>
|
1307 |
+
<Quantity>' . $quantity . '</Quantity>
|
1308 |
+
<LinearFeet>0</LinearFeet>
|
1309 |
+
<Dimensions>
|
1310 |
+
<Length>' . $freight_length . '</Length>
|
1311 |
+
<Width>' . $freight_width . '</Width>
|
1312 |
+
<Height>' . $freight_height . '</Height>
|
1313 |
+
<UnitOfMeasure>IN</UnitOfMeasure>
|
1314 |
+
</Dimensions>
|
1315 |
+
<FreightClass>' . $freight_class . '</FreightClass>
|
1316 |
+
<Weight>
|
1317 |
+
<WeightAmt>' . $weight . '</WeightAmt>
|
1318 |
+
<UnitOfMeasure>LBS</UnitOfMeasure>
|
1319 |
+
</Weight>
|
1320 |
+
<Nmfc>' . $nmfc . '</Nmfc>
|
1321 |
+
</RatesRequest_Item>';
|
1322 |
+
}
|
1323 |
+
?>
|
1324 |
+
<div class="freight_box" id="freight_box<?php
|
1325 |
+
echo $product_id;
|
1326 |
+
?>">
|
1327 |
+
<?php //if($start == 1) {
|
1328 |
+
?>
|
1329 |
+
<div id="fre_ship">
|
1330 |
+
<p style="font-weight:bold;">Choose a carrier for items shipping from
|
1331 |
+
<?php
|
1332 |
+
echo $city;
|
1333 |
+
?>
|
1334 |
+
,
|
1335 |
+
<?php
|
1336 |
+
echo $state;
|
1337 |
+
?>
|
1338 |
+
:</p>
|
1339 |
+
</div>
|
1340 |
+
<?php //}
|
1341 |
+
?>
|
1342 |
+
<ul>
|
1343 |
+
<?php
|
1344 |
+
echo $pro_names;
|
1345 |
+
?>
|
1346 |
+
</ul>
|
1347 |
+
<div id="ajax_response<?php
|
1348 |
+
echo $product_id;
|
1349 |
+
?>">
|
1350 |
+
<?php
|
1351 |
+
$xml = '<?xml version="1.0" encoding="utf-8"?>
|
1352 |
+
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
|
1353 |
+
<soap12:Body>
|
1354 |
+
<GetRates xmlns="http://freightcenter.com/API/V04/">
|
1355 |
+
<request>
|
1356 |
+
<LicenseKey>3BDA740C-FF39-4BDC-AB49-B0A3C08E23B4</LicenseKey>
|
1357 |
+
<Username>'.$freightuser.'</Username>
|
1358 |
+
<Password>'.$freightpwd.'</Password>
|
1359 |
+
<OriginPostalCode>' . $warehouse_postcode . '</OriginPostalCode>
|
1360 |
+
<OriginLocationType>' . $warehouse_location_type . '</OriginLocationType>
|
1361 |
+
<DestinationPostalCode>' . $address . '</DestinationPostalCode>
|
1362 |
+
<DestinationLocationType>'.$new_doc_type.'</DestinationLocationType>
|
1363 |
+
<Items>' . $pro_item . '</Items>
|
1364 |
+
<Accessorials>' . $print_accessorials . '</Accessorials>
|
1365 |
+
<Filters>
|
1366 |
+
<Mode>LTL</Mode>
|
1367 |
+
<IncludeWhiteGlove>false</IncludeWhiteGlove>
|
1368 |
+
<IncludeMotorcycleRates>false</IncludeMotorcycleRates>
|
1369 |
+
<CarrierFilter>
|
1370 |
+
<CarrierFilterType>INCLUDE</CarrierFilterType>
|
1371 |
+
' . $carrier_multi_rate . '
|
1372 |
+
</CarrierFilter>
|
1373 |
+
</Filters>
|
1374 |
+
</request>
|
1375 |
+
</GetRates>
|
1376 |
+
</soap12:Body>
|
1377 |
+
</soap12:Envelope>';
|
1378 |
+
|
1379 |
+
$apiurl = $apirateurl;
|
1380 |
+
|
1381 |
+
$headers = array(
|
1382 |
+
"POST /V04/rates.asmx HTTP/1.1",
|
1383 |
+
"Host: " . $host . "",
|
1384 |
+
"Content-Type: text/xml; charset=utf-8",
|
1385 |
+
"Content-length: " . strlen($xml)
|
1386 |
+
);
|
1387 |
+
//print_r($xml);
|
1388 |
+
|
1389 |
+
/* send curl request to get active carriers */
|
1390 |
+
$soap_do = curl_init();
|
1391 |
+
curl_setopt($soap_do, CURLOPT_URL, $apiurl);
|
1392 |
+
curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true);
|
1393 |
+
curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false);
|
1394 |
+
curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false);
|
1395 |
+
curl_setopt($soap_do, CURLOPT_POST, true);
|
1396 |
+
curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 0);
|
1397 |
+
curl_setopt($soap_do, CURLOPT_TIMEOUT, 400);
|
1398 |
+
curl_setopt($soap_do, CURLOPT_HTTPHEADER, $headers);
|
1399 |
+
curl_setopt($soap_do, CURLOPT_POSTFIELDS, $xml);
|
1400 |
+
|
1401 |
+
$result = curl_exec($soap_do);
|
1402 |
+
|
1403 |
+
curl_close($soap_do);
|
1404 |
+
|
1405 |
+
$p = xml_parser_create();
|
1406 |
+
xml_parse_into_struct($p, $result, $vals, $index);
|
1407 |
+
xml_parser_free($p);
|
1408 |
+
//echo '<pre>'; print_r($vals);
|
1409 |
+
$vals['5']['value'];
|
1410 |
+
if ($vals['5']['value'] == 'ERROR') {
|
1411 |
+
?>
|
1412 |
+
<div>
|
1413 |
+
<input type="radio" style="display:none" class="ajax" id="s_method_flatrate_flatrate" value="" name="shipping_method">
|
1414 |
+
<p> There was a problem with the freight. Do you want to check-out with only non-freight products? </p>
|
1415 |
+
<button onclick="removefreight('yes')" class="button" title="Remove Freight Products" type="button"><span><span>Yes</span></span></button>
|
1416 |
+
</div>
|
1417 |
+
<?php
|
1418 |
+
} else if ($vals['5']['value'] == 'WARNING') {
|
1419 |
+
?>
|
1420 |
+
<div>
|
1421 |
+
<input type="radio" style="display:none" class="ajax" id="s_method_flatrate_flatrate" value="" name="shipping_method">
|
1422 |
+
<p> There was a problem with the freight. Do you want to check-out with only non-freight products? </p>
|
1423 |
+
<button onclick="removefreight('yes')" class="button" title="Remove Freight Products" type="button"><span><span>Yes</span></span></button>
|
1424 |
+
</div>
|
1425 |
+
<?php
|
1426 |
+
} else if (empty($vals)) {
|
1427 |
+
?>
|
1428 |
+
<div>
|
1429 |
+
<input type="radio" style="display:none" class="ajax" id="s_method_flatrate_flatrate" value="" name="shipping_method">
|
1430 |
+
<p> There was a problem with the freight. Do you want to check-out with only non-freight products? </p>
|
1431 |
+
<button onclick="removefreight('yes')" class="button" title="Remove Freight Products" type="button"><span><span>Yes</span></span></button>
|
1432 |
+
</div>
|
1433 |
+
<?php
|
1434 |
+
} else {
|
1435 |
+
$xmlResponseArray = array();
|
1436 |
+
foreach ($vals as $charges) {
|
1437 |
+
|
1438 |
+
if (in_array("TOTALCHARGE", $charges)) {
|
1439 |
+
$xmlResponseArray['TOTALCHARGE'][] = $charges['value'];
|
1440 |
+
}
|
1441 |
+
if (in_array("SERVICENAME", $charges)) {
|
1442 |
+
$xmlResponseArray['SERVICENAME'][] = $charges['value'];
|
1443 |
+
}
|
1444 |
+
if (in_array("SERVICEDAYS", $charges)) {
|
1445 |
+
$xmlResponseArray['SERVICEDAYS'][] = $charges['value'];
|
1446 |
+
}
|
1447 |
+
if (in_array("RATEID", $charges)) {
|
1448 |
+
$xmlResponseArray['RATEID'][] = $charges['value'];
|
1449 |
+
}
|
1450 |
+
}
|
1451 |
+
$xmlResponse = array();
|
1452 |
+
$countedCharges = count($xmlResponseArray['TOTALCHARGE']);
|
1453 |
+
|
1454 |
+
//echo $Carrierdisplay;
|
1455 |
+
for ($j = 0; $j < $Carrierdisplay; $j++) {
|
1456 |
+
$xmlResponse[$j][] = $xmlResponseArray['TOTALCHARGE'][$j];
|
1457 |
+
$xmlResponse[$j][] = $xmlResponseArray['SERVICENAME'][$j];
|
1458 |
+
$xmlResponse[$j][] = $xmlResponseArray['SERVICEDAYS'][$j];
|
1459 |
+
$xmlResponse[$j][] = $xmlResponseArray['RATEID'][$j];
|
1460 |
+
}
|
1461 |
+
?>
|
1462 |
+
<!-- <h4>Select a carrier rate</h4> -->
|
1463 |
+
<?php
|
1464 |
+
// echo '<pre>'; print_r($xmlResponse);
|
1465 |
+
foreach ($xmlResponse as $xmlResponse2) {
|
1466 |
+
$total_charge = $xmlResponse2[0];
|
1467 |
+
$carriers_value = $xmlResponse2[1];
|
1468 |
+
$business_day = $xmlResponse2[2];
|
1469 |
+
$RATEID = $xmlResponse2[3];
|
1470 |
+
|
1471 |
+
if ($total_charge == '') {
|
1472 |
+
?>
|
1473 |
+
<!--<div><p>
|
1474 |
+
“There a problem with the freight. Do you want to check-out with only non-freight products?”
|
1475 |
+
Please click...
|
1476 |
+
</p>
|
1477 |
+
<button onclick="removefreight('yes')" class="button" title="Remove Freight Products" type="button"><span><span>Yes</span></span></button></div> -->
|
1478 |
+
|
1479 |
+
<?php
|
1480 |
+
} else {
|
1481 |
+
|
1482 |
+
/* if($subtotal > $discount_amount){
|
1483 |
+
//echo $total_charge;
|
1484 |
+
if($total_charge < $discount_price){
|
1485 |
+
} else{
|
1486 |
+
$total_charge = $discount_price;
|
1487 |
+
}
|
1488 |
+
} */
|
1489 |
+
//echo $total_charge;
|
1490 |
+
if ($markup == 'none') {
|
1491 |
+
//$gettotal = $myPrice;
|
1492 |
+
$gett = $total_charge;
|
1493 |
+
}
|
1494 |
+
|
1495 |
+
if ($markup == 'markup') {
|
1496 |
+
$gett = $total_charge;
|
1497 |
+
if ($markup_type == 'percent') {
|
1498 |
+
$markup_price = Mage::getStoreConfig('carriers/freightcenter/markup_price');
|
1499 |
+
$gettotal_pr = ($gett * $markup_price) / 100;
|
1500 |
+
$gett = $gett + $gettotal_pr;
|
1501 |
+
|
1502 |
+
} else {
|
1503 |
+
$gett = $gett + $markup_price;
|
1504 |
+
|
1505 |
+
}
|
1506 |
+
}
|
1507 |
+
|
1508 |
+
if ($markup == 'discount') {
|
1509 |
+
$gett = $total_charge;
|
1510 |
+
if ($markup_type == 'percent') {
|
1511 |
+
$markup_price = Mage::getStoreConfig('carriers/freightcenter/markup_price');
|
1512 |
+
$gettotal_pr = ($gett * $markup_price) / 100;
|
1513 |
+
$gett = $gett - $gettotal_pr;
|
1514 |
+
} else {
|
1515 |
+
$gett = $gett - $markup_price;
|
1516 |
+
}
|
1517 |
+
}
|
1518 |
+
|
1519 |
+
?>
|
1520 |
+
<div style="display: none; height: 35px; margin-top: 20px;" class="pls-wait"> <span id="loader_loctype<?php
|
1521 |
+
echo $product_id;
|
1522 |
+
?>"> <img class="v-middle" title="Loading carrier rates..." alt="Loading carrier rates..." src="<?php
|
1523 |
+
echo $this->getSkinUrl('images/opc-ajax-loader.gif');
|
1524 |
+
?>"> </span> <span>Loading Carrier Rates</span> </div>
|
1525 |
+
<div class="ajax-result" id="ajax_result<?php
|
1526 |
+
print $product_id;
|
1527 |
+
?>">
|
1528 |
+
<table>
|
1529 |
+
<tr>
|
1530 |
+
<td width="20"><input type="radio" class="ajax" value="ajax_response" name="shipping<?php
|
1531 |
+
print $product_id;
|
1532 |
+
?>" onclick="ajaxcallnew('<?php
|
1533 |
+
print $product_id;
|
1534 |
+
?>','<?php
|
1535 |
+
print $gett;
|
1536 |
+
?>','<?php
|
1537 |
+
echo $quote_id;
|
1538 |
+
?>','<?php
|
1539 |
+
echo $carriers_value;
|
1540 |
+
?>','<?php
|
1541 |
+
echo $RATEID;
|
1542 |
+
?>',<?php
|
1543 |
+
echo $business_day;
|
1544 |
+
?>, '<?php
|
1545 |
+
echo $total_charge;
|
1546 |
+
?>');" id="ajax<?php
|
1547 |
+
print $product_id;
|
1548 |
+
?>" /></td>
|
1549 |
+
<td><label for="ajax<?php
|
1550 |
+
print $product_id;
|
1551 |
+
?>"><span class="car_show">
|
1552 |
+
<?php
|
1553 |
+
echo $carriers_value;
|
1554 |
+
?>
|
1555 |
+
</span> <span style="display:none;" id="apply_rate<?php
|
1556 |
+
echo $product_id;
|
1557 |
+
?>"> <img class="v-middle" title="Applying carrier rate..." alt="Applying carrier rate..." src="<?php
|
1558 |
+
echo $this->getSkinUrl('images/opc-ajax-loader.gif');
|
1559 |
+
?>" /> </span></label>
|
1560 |
+
<br/>
|
1561 |
+
Estimated Transit Time:
|
1562 |
+
<?php
|
1563 |
+
echo $business_day;
|
1564 |
+
?>
|
1565 |
+
Business days </br>
|
1566 |
+
<?php
|
1567 |
+
if ($gett < $total_charge) {
|
1568 |
+
?>
|
1569 |
+
Cost: $
|
1570 |
+
<?php
|
1571 |
+
print $total_cha = number_format($total_charge, 2, '.', ',');
|
1572 |
+
?>
|
1573 |
+
</br>
|
1574 |
+
Discount: -$
|
1575 |
+
<?php
|
1576 |
+
$discount_gt = $total_charge - $gett;
|
1577 |
+
echo $discount_gt = number_format($discount_gt, 2, '.', ',');
|
1578 |
+
?>
|
1579 |
+
</br>
|
1580 |
+
<?php
|
1581 |
+
}
|
1582 |
+
?>
|
1583 |
+
You Pay: $
|
1584 |
+
<?php
|
1585 |
+
echo $gett = number_format($gett, 2, '.', ',');
|
1586 |
+
?></td>
|
1587 |
+
</tr>
|
1588 |
+
</table>
|
1589 |
+
<div style="clear:both;height:16px;"></div>
|
1590 |
+
</div>
|
1591 |
+
<?php
|
1592 |
+
}
|
1593 |
+
}
|
1594 |
+
}
|
1595 |
+
?>
|
1596 |
+
</div>
|
1597 |
+
</div>
|
1598 |
+
<?php
|
1599 |
+
}
|
1600 |
+
if ($non_freight != NULL) {
|
1601 |
+
?>
|
1602 |
+
<hr />
|
1603 |
+
<div class="freight_box">
|
1604 |
+
<h3>Parcel (Non-Freight) Shipping</h3>
|
1605 |
+
<p>The following items do not require freight shipping. These items ship via parcel providers:</p>
|
1606 |
+
<ul>
|
1607 |
+
<?php
|
1608 |
+
foreach ($non_freight as $non) {
|
1609 |
+
?>
|
1610 |
+
<li>
|
1611 |
+
<?php
|
1612 |
+
echo $non['name'];
|
1613 |
+
?>
|
1614 |
+
</li>
|
1615 |
+
<?php
|
1616 |
+
}
|
1617 |
+
?>
|
1618 |
+
</ul>
|
1619 |
+
</div>
|
1620 |
+
<?php
|
1621 |
+
}
|
1622 |
+
?>
|
1623 |
+
</div>
|
1624 |
+
<?php
|
1625 |
+
}
|
1626 |
+
} else {
|
1627 |
+
?>
|
1628 |
+
<div class="freight_ship" <?php
|
1629 |
+
echo $freight_box;
|
1630 |
+
?>>
|
1631 |
+
<?php
|
1632 |
+
if ($myarray != NULL) {
|
1633 |
+
?>
|
1634 |
+
<input type="hidden" value="<?php
|
1635 |
+
echo $this->getBaseUrl();
|
1636 |
+
?>" id="baseurl" />
|
1637 |
+
<input type="hidden" value="<?php
|
1638 |
+
echo $this->getSkinUrl('images/opc-ajax-loader.gif');
|
1639 |
+
?>" id="loader_url" />
|
1640 |
+
<input type="hidden" value="<?php
|
1641 |
+
echo $allids;
|
1642 |
+
?>" id="freight_ids" />
|
1643 |
+
<input type="hidden" value="<?php
|
1644 |
+
echo $address;
|
1645 |
+
?>" id="post_address" />
|
1646 |
+
<input type="hidden" value="<?php
|
1647 |
+
echo $quote_id;
|
1648 |
+
?>" id="quoteid" />
|
1649 |
+
<?php
|
1650 |
+
$current_freight_user = Mage::getStoreConfig('carriers/freightcenter/dest_loctype');
|
1651 |
+
$CarrierCode = Mage::getStoreConfig('carriers/freightcenter/positions');
|
1652 |
+
$Carrierdisplay = Mage::getStoreConfig('carriers/freightcenter/carrier_display');
|
1653 |
+
$MarkupType = Mage::getStoreConfig('carriers/freightcenter/markup_type');
|
1654 |
+
$MarkupPrice = Mage::getStoreConfig('carriers/freightcenter/markup_price');
|
1655 |
+
$CarrierCode = explode(",", $CarrierCode);
|
1656 |
+
//echo count($CarrierCode);
|
1657 |
+
//if( $Carrierdisplay > count($CarrierCode))
|
1658 |
+
// {
|
1659 |
+
// $Carrierdisplay = count($CarrierCode);
|
1660 |
+
// }
|
1661 |
+
?>
|
1662 |
+
<!-- <div id="carrier_radio_select_div"></div>
|
1663 |
+
<p style="font-size: 15px; font-weight: 600;">Select Carrier</p>
|
1664 |
+
<?php
|
1665 |
+
// for($modz=0;$modz<$Carrierdisplay; $modz++){
|
1666 |
+
?>
|
1667 |
+
<input type="radio" class="ajax_new" value="<?php
|
1668 |
+
echo $CarrierCode[$modz];
|
1669 |
+
?>" name="Carrier" id="ajax_new" onclick="get_carrier();"/>
|
1670 |
+
<label for="ajax_new"><?php
|
1671 |
+
echo $CarrierCode[$modz];
|
1672 |
+
?> </br>
|
1673 |
+
</label> -->
|
1674 |
+
|
1675 |
+
<?php
|
1676 |
+
// }
|
1677 |
+
$crra = explode(",", $current_freight_user);
|
1678 |
+
if (count($crra) < 0) {
|
1679 |
+
} else {
|
1680 |
+
?>
|
1681 |
+
<div>
|
1682 |
+
<!-- <h4>Freight Cost</h4>-->
|
1683 |
+
<h4>Select Location Type</h4>
|
1684 |
+
<select class="required-entry required-entry select" onchange="apicallrate_location(this.value);" name="location_type" id="location_type">
|
1685 |
+
<?php
|
1686 |
+
foreach ($crra as $crr) {
|
1687 |
+
?>
|
1688 |
+
<option value="<?php
|
1689 |
+
echo str_replace(' ', '', $crr);
|
1690 |
+
?>">
|
1691 |
+
<?php
|
1692 |
+
echo $crr;
|
1693 |
+
?>
|
1694 |
+
</option>
|
1695 |
+
<?php
|
1696 |
+
}
|
1697 |
+
?>
|
1698 |
+
</select>
|
1699 |
+
</div>
|
1700 |
+
<?php
|
1701 |
+
}
|
1702 |
+
?>
|
1703 |
+
<div style="margin-top: 10px">
|
1704 |
+
<!--<h4>Select Extra Services</h4>-->
|
1705 |
+
<div class="accessories">
|
1706 |
+
<?php //echo $crra['0']; ?>
|
1707 |
+
<?php if($crra['0'] == 'Residential') { ?>
|
1708 |
+
<input onclick="apicallrateRates();" id="resident1" type="checkbox" value="DEST_INSIDE_DEL" /><label for="resident1" class="access_class">Threshold Delivery</label>
|
1709 |
+
<?php } else if($crra['0'] == 'Business With Dock or Forklift') {?>
|
1710 |
+
<input onclick="apicallrateRates();" id="buswith1" type="checkbox" value="DEST_NOTIFY" /><label for="buswith1" class="access_class">Call before Delivery</label>
|
1711 |
+
<input onclick="apicallrateRates();" id="buswith2" type="checkbox" value="DEST_INSIDE_DEL" /><label for="buswith2" class="access_class">Threshold Delivery</label>
|
1712 |
+
<input onclick="apicallrateRates();" id="buswith3" type="checkbox" value="DEST_LIMITED_DEL" /><label for="buswith3" class="access_class">Limited Access Delivery</label>
|
1713 |
+
|
1714 |
+
<?php } else if($crra['0'] == 'Business Without Dock or Forklift') { ?>
|
1715 |
+
<input onclick="apicallrateRates();" id="buswithout1" type="checkbox" value="DEST_NOTIFY" /><label for="buswithout1" class="access_class">Call before Delivery</label>
|
1716 |
+
<input onclick="apicallrateRates();" id="buswithout2" type="checkbox" value="DEST_INSIDE_DEL" /><label for="buswithout2" class="access_class">Threshold Delivery</label>
|
1717 |
+
<input onclick="apicallrateRates();" id="buswithout4" type="checkbox" value="DEST_LIMITED_DEL" /><label for="buswithout4" class="access_class">Limited Access Delivery</label>
|
1718 |
+
|
1719 |
+
<?php } else if($crra['0'] == 'Construction Site') { ?>
|
1720 |
+
<input onclick="apicallrateRates();" id="const1" type="checkbox" value="DEST_LIFT_GATE" /><label for="const1" class="access_class">Lift Gate at Delivery Point</label>
|
1721 |
+
|
1722 |
+
<?php } else if($crra['0'] == 'Convention Center or Tradeshow') { ?>
|
1723 |
+
<input onclick="apicallrateRates();" id="convent1" type="checkbox" value="DEST_LIFT_GATE" /><label for="convent1" class="access_class">Lift Gate at Delivery Point</label>
|
1724 |
+
|
1725 |
+
<?php } else if($crra['0'] == 'Terminal') { ?>
|
1726 |
+
<input onclick="apicallrateRates();" id="terminal1" type="checkbox" value="DEST_NOTIFY" /><label for="terminal1" class="access_class">Call before Delivery</label>
|
1727 |
+
|
1728 |
+
<?php } ?>
|
1729 |
+
<!-- <input onclick="apicallrateRates();" id="resident1" type="checkbox" value="DEST_INSIDE_DEL" />
|
1730 |
+
<label for="resident1" class="access_class">Threshold Delivery</label>
|
1731 |
+
<input onclick="getaccessRates();" id="resident2" type="checkbox" value="DEST_LIFT_GATE" />
|
1732 |
+
<label for="resident2" class="access_class">Lift Gate at Delivery Point</label>-->
|
1733 |
+
</div>
|
1734 |
+
</div>
|
1735 |
+
<?php
|
1736 |
+
}
|
1737 |
+
|
1738 |
+
?>
|
1739 |
+
<hr />
|
1740 |
+
<div class="freight_box">
|
1741 |
+
<h3>Freight Shipping:</h3>
|
1742 |
+
<ul>
|
1743 |
+
<?php
|
1744 |
+
$attribute_f = Mage::getModel('eav/config')->getAttribute('catalog_product', 'freight_class');
|
1745 |
+
foreach ($attribute_f->getSource()->getAllOptions(true, true) as $opt_menuf) {
|
1746 |
+
$f_attribute[$opt_menuf['value']] = $opt_menuf['label'];
|
1747 |
+
}
|
1748 |
+
|
1749 |
+
$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'packaging_type');
|
1750 |
+
foreach ($attribute->getSource()->getAllOptions(true, true) as $opt_menu1) {
|
1751 |
+
$m_attribute[$opt_menu1['value']] = $opt_menu1['label'];
|
1752 |
+
}
|
1753 |
+
$packaging_type = $m_attribute[$mainarray['packaging_type']];
|
1754 |
+
|
1755 |
+
$attribute1 = Mage::getModel('eav/config')->getAttribute('catalog_product', 'origin_warehouse');
|
1756 |
+
foreach ($attribute1->getSource()->getAllOptions(true, true) as $opt_menu) {
|
1757 |
+
$m1_attribute[$opt_menu['value']] = $opt_menu['label'];
|
1758 |
+
}
|
1759 |
+
|
1760 |
+
/* combine products by warehouse */
|
1761 |
+
|
1762 |
+
foreach ($myarray as $mainarray) {
|
1763 |
+
$product_id = $mainarray['entity_id'];
|
1764 |
+
//$product_descriptions = $mainarray['description'];
|
1765 |
+
$product_description = str_replace(' ', '', $mainarray['description']);
|
1766 |
+
$product_name = $mainarray['name'];
|
1767 |
+
$freight_length = $mainarray['freight_length'];
|
1768 |
+
$freight_width = $mainarray['freight_width'];
|
1769 |
+
$freight_height = $mainarray['freight_height'];
|
1770 |
+
$nmfc = $mainarray['nmfc'];
|
1771 |
+
//$freight_class = $mainarray['freight_class'];
|
1772 |
+
$quantity = $cart_products[$product_id];
|
1773 |
+
$weight = ($mainarray['weight'] * $quantity);
|
1774 |
+
$freight_class = $f_attribute[$mainarray['freight_class']];
|
1775 |
+
|
1776 |
+
$ware_id = $m1_attribute[$mainarray['origin_warehouse']];
|
1777 |
+
$resource = Mage::getSingleton('core/resource');
|
1778 |
+
$readConnection = $resource->getConnection('core_read');
|
1779 |
+
$tableNamep = $resource->getTableName('brst_ship_warehouses');
|
1780 |
+
$queryp = "SELECT * FROM $tableNamep WHERE short_name = '$ware_id' LIMIT 10";
|
1781 |
+
$results = $readConnection->fetchAll($queryp);
|
1782 |
+
?>
|
1783 |
+
<li>
|
1784 |
+
<?php
|
1785 |
+
echo $product_name;
|
1786 |
+
?>
|
1787 |
+
</li>
|
1788 |
+
<?php
|
1789 |
+
|
1790 |
+
foreach ($results as $ware_result) {
|
1791 |
+
$warehouse_name = $ware_result['short_name'];
|
1792 |
+
//$warehouse_location_types = $ware_result['location_type'];
|
1793 |
+
$warehouse_location_type = str_replace(' ', '', $ware_result['location_type']);
|
1794 |
+
$ware_cmpny_postcode = $ware_result['cmpny_postcode'];
|
1795 |
+
}
|
1796 |
+
|
1797 |
+
?>
|
1798 |
+
<input type="hidden" value="<?php
|
1799 |
+
echo $product_id;
|
1800 |
+
?>" name="<?php
|
1801 |
+
echo $product_id;
|
1802 |
+
?>" id="product_id"/>
|
1803 |
+
<input type="hidden" value="<?php
|
1804 |
+
echo $product_description;
|
1805 |
+
?>" name="<?php
|
1806 |
+
echo $product_description;
|
1807 |
+
?>" id="product_description"/>
|
1808 |
+
<input type="hidden" value="<?php
|
1809 |
+
echo $product_name;
|
1810 |
+
?>" name="<?php
|
1811 |
+
echo $product_name;
|
1812 |
+
?>" id="product_name"/>
|
1813 |
+
<input type="hidden" value="<?php
|
1814 |
+
echo $freight_length;
|
1815 |
+
?>" name="<?php
|
1816 |
+
echo $freight_length;
|
1817 |
+
?>" id="freight_length"/>
|
1818 |
+
<input type="hidden" value="<?php
|
1819 |
+
echo $freight_width;
|
1820 |
+
?>" name="<?php
|
1821 |
+
echo $freight_width;
|
1822 |
+
?>" id="freight_width"/>
|
1823 |
+
<input type="hidden" value="<?php
|
1824 |
+
echo $freight_height;
|
1825 |
+
?>" name="<?php
|
1826 |
+
echo $freight_height;
|
1827 |
+
?>" id="freight_height"/>
|
1828 |
+
<input type="hidden" value="<?php
|
1829 |
+
echo $nmfc;
|
1830 |
+
?>" name="<?php
|
1831 |
+
echo $nmfc;
|
1832 |
+
?>" id="nmfc"/>
|
1833 |
+
<input type="hidden" value="<?php
|
1834 |
+
echo $weight;
|
1835 |
+
?>" name="<?php
|
1836 |
+
echo $weight;
|
1837 |
+
?>" id="weight"/>
|
1838 |
+
<input type="hidden" value="<?php
|
1839 |
+
echo $freight_class;
|
1840 |
+
?>" name="<?php
|
1841 |
+
echo $freight_class;
|
1842 |
+
?>" id="freight_class"/>
|
1843 |
+
<input type="hidden" value="<?php
|
1844 |
+
echo $packaging_type;
|
1845 |
+
?>" name="<?php
|
1846 |
+
echo $packaging_type;
|
1847 |
+
?>" id="packaging_type"/>
|
1848 |
+
<input type="hidden" value="<?php
|
1849 |
+
echo $address;
|
1850 |
+
?>" name="<?php
|
1851 |
+
echo $address;
|
1852 |
+
?>" id="address"/>
|
1853 |
+
<input type="hidden" value="<?php
|
1854 |
+
echo $current_page;
|
1855 |
+
?>" name="<?php
|
1856 |
+
echo $current_page;
|
1857 |
+
?>" id="current_page"/>
|
1858 |
+
<input type="hidden" value="<?php
|
1859 |
+
echo $ware_cmpny_postcode;
|
1860 |
+
?>" name="<?php
|
1861 |
+
echo $ware_cmpny_postcode;
|
1862 |
+
?>" id="ware_cmpny_postcode"/>
|
1863 |
+
<input type="hidden" value="<?php
|
1864 |
+
echo $warehouse_name;
|
1865 |
+
?>" name="<?php
|
1866 |
+
echo $warehouse_name;
|
1867 |
+
?>" id="warehouse_name"/>
|
1868 |
+
<input type="hidden" value="<?php
|
1869 |
+
echo $warehouse_location_type;
|
1870 |
+
?>" name="<?php
|
1871 |
+
echo $warehouse_location_type;
|
1872 |
+
?>" id="warehouse_location_type"/>
|
1873 |
+
<input type="hidden" value="<?php
|
1874 |
+
echo $quote_id;
|
1875 |
+
?>" name="<?php
|
1876 |
+
echo $quote_id;
|
1877 |
+
?>" id="quote_id"/>
|
1878 |
+
<input type="hidden" onclick="apicallrate();" name="freight Products" id="newCheck<?php
|
1879 |
+
echo $product_id;
|
1880 |
+
?>" />
|
1881 |
+
<?php
|
1882 |
+
|
1883 |
+
|
1884 |
+
}
|
1885 |
+
|
1886 |
+
?>
|
1887 |
+
<script>
|
1888 |
+
jQuery( document ).ready(function() {
|
1889 |
+
//alert('hello');
|
1890 |
+
apicallrate();
|
1891 |
+
});
|
1892 |
+
</script>
|
1893 |
+
<div style="display: block; height: 35px; margin-top: 20px;" id="pls_wait"> <span id="loader_loctype<?php
|
1894 |
+
echo $product_id;
|
1895 |
+
?>"> <img class="v-middle" title="Loading carrier rates..." alt="Loading carrier rates..." src="<?php
|
1896 |
+
echo $this->getSkinUrl('images/opc-ajax-loader.gif');
|
1897 |
+
?>"> </span> <span>Loading Carrier Rates</span> </div>
|
1898 |
+
<div id="ajax_response_else"></div>
|
1899 |
+
</ul>
|
1900 |
+
</div>
|
1901 |
+
<?php
|
1902 |
+
if ($non_freight != NULL) {
|
1903 |
+
?>
|
1904 |
+
<hr />
|
1905 |
+
<div class="freight_box">
|
1906 |
+
<h3>Parcel (Non-Freight) Shipping</h3>
|
1907 |
+
<p>The following items do not require freight shipping. These items ship via parcel providers:</p>
|
1908 |
+
<ul>
|
1909 |
+
<?php
|
1910 |
+
foreach ($non_freight as $non) {
|
1911 |
+
?>
|
1912 |
+
<li>
|
1913 |
+
<?php
|
1914 |
+
echo $non['name'];
|
1915 |
+
?>
|
1916 |
+
</li>
|
1917 |
+
<?php
|
1918 |
+
}
|
1919 |
+
?>
|
1920 |
+
</ul>
|
1921 |
+
<?php
|
1922 |
+
}
|
1923 |
+
?>
|
1924 |
+
<?php
|
1925 |
+
}
|
1926 |
+
}
|
1927 |
+
?>
|
1928 |
+
<div class="sp-methods"<?php
|
1929 |
+
echo $ship_style;
|
1930 |
+
?>>
|
1931 |
+
<?php
|
1932 |
+
$shippingCodePrice = array();
|
1933 |
+
$_sole = count($_shippingRateGroups) == 1;
|
1934 |
+
foreach ($_shippingRateGroups as $code => $_rates):
|
1935 |
+
?>
|
1936 |
+
<div <?php
|
1937 |
+
if ($code == 'freightcenter') {
|
1938 |
+
?>style="display: none;" <?php
|
1939 |
+
} else {
|
1940 |
+
?> class="other_method"<?php
|
1941 |
+
}
|
1942 |
+
?>
|
1943 |
+
>
|
1944 |
+
<strong>
|
1945 |
+
<?php
|
1946 |
+
echo $this->escapeHtml($this->getCarrierName($code));
|
1947 |
+
?>
|
1948 |
+
</strong>
|
1949 |
+
<div style="clear:both;"></div>
|
1950 |
+
<?php
|
1951 |
+
$_sole = $_sole && count($_rates) == 1;
|
1952 |
+
foreach ($_rates as $_rate):
|
1953 |
+
?>
|
1954 |
+
<?php
|
1955 |
+
$shippingCodePrice[] = "'" . $_rate->getCode() . "':" . (float) $_rate->getPrice();
|
1956 |
+
?>
|
1957 |
+
<?php
|
1958 |
+
if ($_rate->getErrorMessage()):
|
1959 |
+
?>
|
1960 |
+
<ul class="messages">
|
1961 |
+
<li class="error-msg">
|
1962 |
+
<ul>
|
1963 |
+
<li>
|
1964 |
+
<?php
|
1965 |
+
echo $this->escapeHtml($_rate->getErrorMessage());
|
1966 |
+
?>
|
1967 |
+
</li>
|
1968 |
+
</ul>
|
1969 |
+
</li>
|
1970 |
+
</ul>
|
1971 |
+
<?php
|
1972 |
+
else:
|
1973 |
+
?>
|
1974 |
+
<?php
|
1975 |
+
if ($_sole):
|
1976 |
+
?>
|
1977 |
+
<span class="no-display">
|
1978 |
+
<input name="shipping_method" type="radio" value="<?php
|
1979 |
+
echo $_rate->getCode();
|
1980 |
+
?>" id="s_method_<?php
|
1981 |
+
echo $_rate->getCode();
|
1982 |
+
?>" checked="checked" />
|
1983 |
+
</span>
|
1984 |
+
<?php
|
1985 |
+
else:
|
1986 |
+
?>
|
1987 |
+
<input name="shipping_method" type="radio" value="<?php
|
1988 |
+
echo $_rate->getCode();
|
1989 |
+
?>" id="s_method_<?php
|
1990 |
+
echo $_rate->getCode();
|
1991 |
+
?>"<?php
|
1992 |
+
if ($code == 'freightcenter' && $non_freight == NULL) {
|
1993 |
+
echo 'checked';
|
1994 |
+
}
|
1995 |
+
?> class="radio"/>
|
1996 |
+
<?php
|
1997 |
+
if ($_rate->getCode() === $this->getAddressShippingMethod()):
|
1998 |
+
?>
|
1999 |
+
<script type="text/javascript">
|
2000 |
+
//<![CDATA[
|
2001 |
+
lastPrice = <?php
|
2002 |
+
echo (float) $_rate->getPrice();
|
2003 |
+
?>;
|
2004 |
+
//]]>
|
2005 |
+
</script>
|
2006 |
+
<?php
|
2007 |
+
endif;
|
2008 |
+
?>
|
2009 |
+
<?php
|
2010 |
+
endif;
|
2011 |
+
?>
|
2012 |
+
<label for="s_method_<?php
|
2013 |
+
echo $_rate->getCode();
|
2014 |
+
?>">
|
2015 |
+
<?php
|
2016 |
+
echo $this->escapeHtml($_rate->getMethodTitle());
|
2017 |
+
?>
|
2018 |
+
<?php
|
2019 |
+
$_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax());
|
2020 |
+
?>
|
2021 |
+
<?php
|
2022 |
+
$_incl = $this->getShippingPrice($_rate->getPrice(), true);
|
2023 |
+
?>
|
2024 |
+
<?php
|
2025 |
+
echo $_excl;
|
2026 |
+
?>
|
2027 |
+
<?php
|
2028 |
+
if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl):
|
2029 |
+
?>
|
2030 |
+
(
|
2031 |
+
<?php
|
2032 |
+
echo $this->__('Incl. Tax');
|
2033 |
+
?>
|
2034 |
+
<?php
|
2035 |
+
echo $_incl;
|
2036 |
+
?>
|
2037 |
+
)
|
2038 |
+
<?php
|
2039 |
+
endif;
|
2040 |
+
?>
|
2041 |
+
</label>
|
2042 |
+
<?php
|
2043 |
+
endif;
|
2044 |
+
?>
|
2045 |
+
<?php
|
2046 |
+
endforeach;
|
2047 |
+
?>
|
2048 |
+
</div>
|
2049 |
+
<?php
|
2050 |
+
endforeach;
|
2051 |
+
?>
|
2052 |
+
</div>
|
2053 |
+
<script type="text/javascript">
|
2054 |
+
//<![CDATA[
|
2055 |
+
<?php
|
2056 |
+
if (!empty($shippingCodePrice)):
|
2057 |
+
?>
|
2058 |
+
var shippingCodePrice = {<?php
|
2059 |
+
echo implode(',', $shippingCodePrice);
|
2060 |
+
?>};
|
2061 |
+
<?php
|
2062 |
+
endif;
|
2063 |
+
?>
|
2064 |
+
|
2065 |
+
$$('input[type="radio"][name="shipping_method"]').each(function(el){
|
2066 |
+
Event.observe(el, 'click', function(){
|
2067 |
+
if (el.checked == true) {
|
2068 |
+
var getShippingCode = el.getValue();
|
2069 |
+
<?php
|
2070 |
+
if (!empty($shippingCodePrice)):
|
2071 |
+
?>
|
2072 |
+
var newPrice = shippingCodePrice[getShippingCode];
|
2073 |
+
if (!lastPrice) {
|
2074 |
+
lastPrice = newPrice;
|
2075 |
+
quoteBaseGrandTotal += newPrice;
|
2076 |
+
}
|
2077 |
+
if (newPrice != lastPrice) {
|
2078 |
+
quoteBaseGrandTotal += (newPrice-lastPrice);
|
2079 |
+
lastPrice = newPrice;
|
2080 |
+
}
|
2081 |
+
<?php
|
2082 |
+
endif;
|
2083 |
+
?>
|
2084 |
+
checkQuoteBaseGrandTotal = quoteBaseGrandTotal;
|
2085 |
+
return false;
|
2086 |
+
}
|
2087 |
+
});
|
2088 |
+
});
|
2089 |
+
//]]>
|
2090 |
+
</script>
|
2091 |
+
<?php
|
2092 |
+
endif;
|
2093 |
+
?>
|
2094 |
+
<script>
|
2095 |
+
jQuery.noConflict();
|
2096 |
+
</script>
|
app/design/frontend/base/default/template/fee/fee.phtml
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<h4><?php echo $this->__('Module List') ?></h4>
|
2 |
+
<?php
|
3 |
+
|
4 |
+
/*
|
5 |
+
This shows how to load specific fields from a record in the database.
|
6 |
+
1) Note the load(15), this corresponds to saying "select * from table where table_id = 15"
|
7 |
+
2) You can then just use the get(fieldname) to pull specific data from the table.
|
8 |
+
3) If you have a field named news_id, then it becomes getNewsId, etc.
|
9 |
+
*/
|
10 |
+
/*
|
11 |
+
$news = Mage::getModel('fee/fee')->load(15);
|
12 |
+
echo $news->getNewsId();
|
13 |
+
echo $news->getTitle();
|
14 |
+
echo $news->getContent();
|
15 |
+
echo $news->getStatus();
|
16 |
+
*/
|
17 |
+
|
18 |
+
/*
|
19 |
+
This shows an alternate way of loading datas from a record using the database the "Magento Way" (using blocks and controller).
|
20 |
+
Uncomment blocks in /app/code/local/Namespace/Module/controllers/IndexController.php if you want to use it.
|
21 |
+
|
22 |
+
*/
|
23 |
+
/*
|
24 |
+
$object = $this->getFee();
|
25 |
+
echo 'id: '.$object['test_id'].'<br/>';
|
26 |
+
echo 'title: '.$object['title'].'<br/>';
|
27 |
+
echo 'content: '.$object['content'].'<br/>';
|
28 |
+
echo 'status: '.$object['status'].'<br/>';
|
29 |
+
*/
|
30 |
+
|
31 |
+
|
32 |
+
/*
|
33 |
+
This shows how to load multiple rows in a collection and save a change to them.
|
34 |
+
1) The setPageSize function will load only 5 records per page and you can set the current Page with the setCurPage function.
|
35 |
+
2) The $collection->walk('save') allows you to save everything in the collection after all changes have been made.
|
36 |
+
*/
|
37 |
+
/*
|
38 |
+
$i = 0;
|
39 |
+
|
40 |
+
$collection = Mage::getModel('fee/fee')->getCollection();
|
41 |
+
$collection->setPageSize(5);
|
42 |
+
$collection->setCurPage(2);
|
43 |
+
$size = $collection->getSize();
|
44 |
+
$cnt = count($collection);
|
45 |
+
foreach ($collection as $item) {
|
46 |
+
$i = $i+1;
|
47 |
+
$item->setTitle($i);
|
48 |
+
echo $item->getTitle();
|
49 |
+
}
|
50 |
+
|
51 |
+
$collection->walk('save');
|
52 |
+
*/
|
53 |
+
|
54 |
+
/*
|
55 |
+
This shows how to load a single record and save a change.
|
56 |
+
1) Note the setTitle, this corresponds to the table field name, title, and then you pass it the text to change.
|
57 |
+
2) Call the save() function only on a single record.
|
58 |
+
*/
|
59 |
+
/*
|
60 |
+
$object = Mage::getModel('fee/fee')->load(1);
|
61 |
+
$object->setTitle('This is a changed title');
|
62 |
+
$object->save();
|
63 |
+
*/
|
64 |
+
|
65 |
+
?>
|
app/design/frontend/base/default/template/page/html/head.phtml
ADDED
@@ -0,0 +1,471 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
?>
|
4 |
+
<meta http-equiv="Content-Type" content="<?php echo $this->getContentType() ?>" />
|
5 |
+
<title><?php echo $this->getTitle() ?></title>
|
6 |
+
<meta name="description" content="<?php echo htmlspecialchars($this->getDescription()) ?>" />
|
7 |
+
<meta name="keywords" content="<?php echo htmlspecialchars($this->getKeywords()) ?>" />
|
8 |
+
<meta name="robots" content="<?php echo htmlspecialchars($this->getRobots()) ?>" />
|
9 |
+
<link rel="icon" href="<?php echo $this->getFaviconFile(); ?>" type="image/x-icon" />
|
10 |
+
<link rel="shortcut icon" href="<?php echo $this->getFaviconFile(); ?>" type="image/x-icon" />
|
11 |
+
<!--[if lt IE 7]>
|
12 |
+
<script type="text/javascript">
|
13 |
+
//<![CDATA[
|
14 |
+
var BLANK_URL = '<?php echo $this->helper('core/js')->getJsUrl('blank.html') ?>';
|
15 |
+
var BLANK_IMG = '<?php echo $this->helper('core/js')->getJsUrl('spacer.gif') ?>';
|
16 |
+
//]]>
|
17 |
+
</script>
|
18 |
+
<![endif]-->
|
19 |
+
<?php echo $this->getCssJsHtml() ?>
|
20 |
+
<?php echo $this->getChildHtml() ?>
|
21 |
+
<?php echo $this->helper('core/js')->getTranslatorScript() ?>
|
22 |
+
<?php echo $this->getIncludes() ?>
|
23 |
+
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
|
24 |
+
<script type="text/javascript">
|
25 |
+
jQuery.noConflict();
|
26 |
+
|
27 |
+
//freight functions
|
28 |
+
function get_carrier(){
|
29 |
+
var carrier = jQuery("input[name=Carrier]:radio:checked").val();
|
30 |
+
jQuery( "#carrier_radio_select" ).remove();
|
31 |
+
jQuery('<input>')
|
32 |
+
.attr('id', 'carrier_radio_select')
|
33 |
+
.attr('type', 'hidden')
|
34 |
+
.attr('value', carrier)
|
35 |
+
.appendTo('#carrier_radio_select_div')
|
36 |
+
|
37 |
+
}
|
38 |
+
|
39 |
+
|
40 |
+
|
41 |
+
function getrate_again(val,ids,address,qtid) {
|
42 |
+
var baseurl = jQuery('#baseurl').val();
|
43 |
+
if (baseurl.indexOf("index.php") >= 0) {
|
44 |
+
var url = baseurl.replace('/index.php','');
|
45 |
+
}
|
46 |
+
else {
|
47 |
+
var url = baseurl;
|
48 |
+
}
|
49 |
+
var loader_img = jQuery('#loader_url').val();
|
50 |
+
var warehouse_postcode = jQuery('#warehouse_postcode').val();
|
51 |
+
var carrier_radio_select = jQuery('#carrier_radio_select').val();
|
52 |
+
jQuery('.ajax-result').hide();
|
53 |
+
jQuery('.please-wait').hide();
|
54 |
+
jQuery('.pls-wait').show();
|
55 |
+
|
56 |
+
var newaccess;
|
57 |
+
if(val === 'Residential') {
|
58 |
+
newaccess = '<input onclick="getaccessRates();" id="resident1" type="checkbox" value="DEST_INSIDE_DEL" /><label for="resident1" class="access_class">Threshold Delivery</label>';
|
59 |
+
jQuery('.accessories').html(newaccess);
|
60 |
+
} else if(val === 'BusinessWithDockorForklift') {
|
61 |
+
newaccess = '<input onclick="getaccessRates();" id="buswith1" type="checkbox" value="DEST_NOTIFY" /><label for="buswith1" class="access_class">Call before Delivery</label>\n\
|
62 |
+
<input onclick="getaccessRates();" id="buswith2" type="checkbox" value="DEST_INSIDE_DEL" /><label for="buswith2" class="access_class">Threshold Delivery</label>\n\
|
63 |
+
<input onclick="getaccessRates();" id="buswith3" type="checkbox" value="DEST_LIMITED_DEL" /><label for="buswith3" class="access_class">Limited Access Delivery</label>';
|
64 |
+
jQuery('.accessories').html(newaccess);
|
65 |
+
} else if(val === 'BusinessWithoutDockorForklift') {
|
66 |
+
newaccess = '<input onclick="getaccessRates();" id="buswithout1" type="checkbox" value="DEST_NOTIFY" /><label for="buswithout1" class="access_class">Call before Delivery</label>\n\
|
67 |
+
<input onclick="getaccessRates();" id="buswithout2" type="checkbox" value="DEST_INSIDE_DEL" /><label for="buswithout2" class="access_class">Threshold Delivery</label>\n\
|
68 |
+
<input onclick="getaccessRates();" id="buswithout4" type="checkbox" value="DEST_LIMITED_DEL" /><label for="buswithout4" class="access_class">Limited Access Delivery</label>';
|
69 |
+
jQuery('.accessories').html(newaccess);
|
70 |
+
} else if(val === 'ConstructionSite') {
|
71 |
+
newaccess = '<input onclick="getaccessRates();" id="const1" type="checkbox" value="DEST_LIFT_GATE" /><label for="const1" class="access_class">Lift Gate at Delivery Point</label>';
|
72 |
+
jQuery('.accessories').html(newaccess);
|
73 |
+
} else if(val === 'ConventionCenterorTradeshow') {
|
74 |
+
newaccess = '<input onclick="getaccessRates();" id="convent1" type="checkbox" value="DEST_LIFT_GATE" /><label for="convent1" class="access_class">Lift Gate at Delivery Point</label>';
|
75 |
+
jQuery('.accessories').html(newaccess);
|
76 |
+
} else if(val === 'Terminal') {
|
77 |
+
newaccess = '<input onclick="getaccessRates();" id="terminal1" type="checkbox" value="DEST_NOTIFY" /><label for="terminal1" class="access_class">Call before Delivery</label>';
|
78 |
+
jQuery('.accessories').html(newaccess);
|
79 |
+
}
|
80 |
+
|
81 |
+
jQuery.ajax({
|
82 |
+
url:url+'loctype_api.php',
|
83 |
+
type: "POST",
|
84 |
+
dataType:"json",
|
85 |
+
data:({
|
86 |
+
loctype:val,
|
87 |
+
proid:ids,
|
88 |
+
address:address,
|
89 |
+
quote:qtid,
|
90 |
+
img:loader_img,
|
91 |
+
warehouse_postcode:warehouse_postcode,
|
92 |
+
carrier_radio_select:carrier_radio_select
|
93 |
+
}),
|
94 |
+
success: function(data) {
|
95 |
+
jQuery('.pls-wait').hide();
|
96 |
+
jQuery.each( data.rates, function( key, value ) {
|
97 |
+
var newdata = '<div style="display: none; height: 35px; margin-top: 20px;" class="pls-wait"><span id="loader_loctype'+key+'">\n\
|
98 |
+
<img class="v-middle" title="Loading carrier rates..." alt="Loading carrier rates..." src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif'); ?>"></span>\n\
|
99 |
+
<span>Loading Carrier Rates</span></div>'+value;
|
100 |
+
jQuery('#ajax_response'+key).html(newdata);
|
101 |
+
});
|
102 |
+
}
|
103 |
+
});
|
104 |
+
}
|
105 |
+
|
106 |
+
function getrate_again_one(val,ids,address,qtid) {
|
107 |
+
var baseurl = jQuery('#baseurl').val();
|
108 |
+
if (baseurl.indexOf("index.php") >= 0) {
|
109 |
+
var url = baseurl.replace('/index.php','');
|
110 |
+
}
|
111 |
+
else {
|
112 |
+
var url = baseurl;
|
113 |
+
}
|
114 |
+
var loader_img = jQuery('#loader_url').val();
|
115 |
+
var warehouse_postcode = jQuery('#warehouse_postcode').val();
|
116 |
+
var carrier_radio_select = jQuery('#carrier_radio_select').val();
|
117 |
+
jQuery('.ajax-result').hide();
|
118 |
+
jQuery('.please-wait').hide();
|
119 |
+
jQuery('.pls-wait').show();
|
120 |
+
|
121 |
+
var newaccess;
|
122 |
+
if(val === 'Residential') {
|
123 |
+
newaccess = '<input onclick="getaccessRates_one();" id="resident1" type="checkbox" value="DEST_INSIDE_DEL" /><label for="resident1" class="access_class">Threshold Delivery</label>';
|
124 |
+
jQuery('.accessories').html(newaccess);
|
125 |
+
} else if(val === 'BusinessWithDockorForklift') {
|
126 |
+
newaccess = '<input onclick="getaccessRates_one();" id="buswith1" type="checkbox" value="DEST_NOTIFY" /><label for="buswith1" class="access_class">Call before Delivery</label>\n\
|
127 |
+
<input onclick="getaccessRates_one();" id="buswith2" type="checkbox" value="DEST_INSIDE_DEL" /><label for="buswith2" class="access_class">Threshold Delivery</label>\n\
|
128 |
+
<input onclick="getaccessRates_one();" id="buswith3" type="checkbox" value="DEST_LIMITED_DEL" /><label for="buswith3" class="access_class">Limited Access Delivery</label>';
|
129 |
+
jQuery('.accessories').html(newaccess);
|
130 |
+
} else if(val === 'BusinessWithoutDockorForklift') {
|
131 |
+
newaccess = '<input onclick="getaccessRates_one();" id="buswithout1" type="checkbox" value="DEST_NOTIFY" /><label for="buswithout1" class="access_class">Call before Delivery</label>\n\
|
132 |
+
<input onclick="getaccessRates_one();" id="buswithout2" type="checkbox" value="DEST_INSIDE_DEL" /><label for="buswithout2" class="access_class">Threshold Delivery</label>\n\
|
133 |
+
<input onclick="getaccessRates_one();" id="buswithout4" type="checkbox" value="DEST_LIMITED_DEL" /><label for="buswithout4" class="access_class">Limited Access Delivery</label>';
|
134 |
+
jQuery('.accessories').html(newaccess);
|
135 |
+
} else if(val === 'ConstructionSite') {
|
136 |
+
newaccess = '<input onclick="getaccessRates_one();" id="const1" type="checkbox" value="DEST_LIFT_GATE" /><label for="const1" class="access_class">Lift Gate at Delivery Point</label>';
|
137 |
+
jQuery('.accessories').html(newaccess);
|
138 |
+
} else if(val === 'ConventionCenterorTradeshow') {
|
139 |
+
newaccess = '<input onclick="getaccessRates_one();" id="convent1" type="checkbox" value="DEST_LIFT_GATE" /><label for="convent1" class="access_class">Lift Gate at Delivery Point</label>';
|
140 |
+
jQuery('.accessories').html(newaccess);
|
141 |
+
} else if(val === 'Terminal') {
|
142 |
+
newaccess = '<input onclick="getaccessRates_one();" id="terminal1" type="checkbox" value="DEST_NOTIFY" /><label for="terminal1" class="access_class">Call before Delivery</label>';
|
143 |
+
jQuery('.accessories').html(newaccess);
|
144 |
+
}
|
145 |
+
|
146 |
+
jQuery.ajax({
|
147 |
+
url:url+'loctype_api_one.php',
|
148 |
+
type: "POST",
|
149 |
+
dataType:"json",
|
150 |
+
data:({
|
151 |
+
loctype:val,
|
152 |
+
proid:ids,
|
153 |
+
address:address,
|
154 |
+
quote:qtid,
|
155 |
+
img:loader_img,
|
156 |
+
warehouse_postcode:warehouse_postcode,
|
157 |
+
carrier_radio_select:carrier_radio_select
|
158 |
+
}),
|
159 |
+
success: function(data) {
|
160 |
+
jQuery('.pls-wait').hide();
|
161 |
+
jQuery.each( data.rates, function( key, value ) {
|
162 |
+
var newdata = '<div style="display: none; height: 35px; margin-top: 20px;" class="pls-wait"><span id="loader_loctype'+key+'">\n\
|
163 |
+
<img class="v-middle" title="Loading carrier rates..." alt="Loading carrier rates..." src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif'); ?>"></span>\n\
|
164 |
+
<span>Loading Carrier Rates</span></div>'+value;
|
165 |
+
jQuery('#ajax_response'+key).html(newdata);
|
166 |
+
});
|
167 |
+
}
|
168 |
+
});
|
169 |
+
}
|
170 |
+
|
171 |
+
function getaccessRates() {
|
172 |
+
var searchIDs = [];
|
173 |
+
jQuery(".accessories input:checkbox:checked").map(function(){
|
174 |
+
searchIDs.push(jQuery(this).val());
|
175 |
+
});
|
176 |
+
|
177 |
+
var baseurl = jQuery('#baseurl').val();
|
178 |
+
var warehouse_postcode = jQuery('#warehouse_postcode').val();
|
179 |
+
if (baseurl.indexOf("index.php") >= 0) {
|
180 |
+
var url = baseurl.replace('/index.php','');
|
181 |
+
}
|
182 |
+
else {
|
183 |
+
var url = baseurl;
|
184 |
+
}
|
185 |
+
var loader_img = jQuery('#loader_url').val();
|
186 |
+
var loctype = jQuery('#location_type').val();
|
187 |
+
var carrier_radio_select = jQuery('#carrier_radio_select').val();
|
188 |
+
|
189 |
+
var ids = jQuery('#freight_ids').val();
|
190 |
+
var address = jQuery('#post_address').val();
|
191 |
+
var qtid = jQuery('#quoteid').val();
|
192 |
+
|
193 |
+
jQuery('.ajax-result').hide();
|
194 |
+
jQuery('.please-wait').hide();
|
195 |
+
jQuery('.pls-wait').show();
|
196 |
+
|
197 |
+
jQuery.ajax({
|
198 |
+
url:url+'loctype_api.php',
|
199 |
+
type: "POST",
|
200 |
+
dataType:"json",
|
201 |
+
data:({
|
202 |
+
loctype:loctype,
|
203 |
+
proid:ids,
|
204 |
+
address:address,
|
205 |
+
quote:qtid,
|
206 |
+
img:loader_img,
|
207 |
+
accessorials:searchIDs,
|
208 |
+
warehouse_postcode:warehouse_postcode,
|
209 |
+
carrier_radio_select:carrier_radio_select
|
210 |
+
}),
|
211 |
+
success: function(data) {
|
212 |
+
jQuery('.pls-wait').hide();
|
213 |
+
jQuery.each( data.rates, function( key, value ) {
|
214 |
+
var newdata = '<div style="display: none; height: 35px; margin-top: 20px;" class="pls-wait"><span id="loader_loctype'+key+'">\n\
|
215 |
+
<img class="v-middle" title="Loading carrier rates..." alt="Loading carrier rates..." src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif'); ?>"></span>\n\
|
216 |
+
<span>Loading Carrier Rates</span></div>'+value;
|
217 |
+
jQuery('#ajax_response'+key).html(newdata);
|
218 |
+
});
|
219 |
+
}
|
220 |
+
});
|
221 |
+
}
|
222 |
+
function getaccessRates_one() {
|
223 |
+
var searchIDs = [];
|
224 |
+
jQuery(".accessories input:checkbox:checked").map(function(){
|
225 |
+
searchIDs.push(jQuery(this).val());
|
226 |
+
});
|
227 |
+
|
228 |
+
var baseurl = jQuery('#baseurl').val();
|
229 |
+
var warehouse_postcode = jQuery('#warehouse_postcode').val();
|
230 |
+
if (baseurl.indexOf("index.php") >= 0) {
|
231 |
+
var url = baseurl.replace('/index.php','');
|
232 |
+
}
|
233 |
+
else {
|
234 |
+
var url = baseurl;
|
235 |
+
}
|
236 |
+
var loader_img = jQuery('#loader_url').val();
|
237 |
+
var loctype = jQuery('#location_type').val();
|
238 |
+
var carrier_radio_select = jQuery('#carrier_radio_select').val();
|
239 |
+
|
240 |
+
var ids = jQuery('#freight_ids').val();
|
241 |
+
var address = jQuery('#post_address').val();
|
242 |
+
var qtid = jQuery('#quoteid').val();
|
243 |
+
|
244 |
+
jQuery('.ajax-result').hide();
|
245 |
+
jQuery('.please-wait').hide();
|
246 |
+
jQuery('.pls-wait').show();
|
247 |
+
|
248 |
+
jQuery.ajax({
|
249 |
+
url:url+'loctype_api_one.php',
|
250 |
+
type: "POST",
|
251 |
+
dataType:"json",
|
252 |
+
data:({
|
253 |
+
loctype:loctype,
|
254 |
+
proid:ids,
|
255 |
+
address:address,
|
256 |
+
quote:qtid,
|
257 |
+
img:loader_img,
|
258 |
+
accessorials:searchIDs,
|
259 |
+
warehouse_postcode:warehouse_postcode,
|
260 |
+
carrier_radio_select:carrier_radio_select
|
261 |
+
}),
|
262 |
+
success: function(data) {
|
263 |
+
jQuery('.pls-wait').hide();
|
264 |
+
jQuery.each( data.rates, function( key, value ) {
|
265 |
+
var newdata = '<div style="display: none; height: 35px; margin-top: 20px;" class="pls-wait"><span id="loader_loctype'+key+'">\n\
|
266 |
+
<img class="v-middle" title="Loading carrier rates..." alt="Loading carrier rates..." src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif'); ?>"></span>\n\
|
267 |
+
<span>Loading Carrier Rates</span></div>'+value;
|
268 |
+
jQuery('#ajax_response'+key).html(newdata);
|
269 |
+
});
|
270 |
+
}
|
271 |
+
});
|
272 |
+
}
|
273 |
+
|
274 |
+
|
275 |
+
|
276 |
+
|
277 |
+
|
278 |
+
function apicallrate(){
|
279 |
+
var current_page = jQuery("#current_page").val();
|
280 |
+
var quote_id = jQuery("#quote_id").val();
|
281 |
+
var weight = jQuery("#weight").val();
|
282 |
+
var address = jQuery("#address").val();
|
283 |
+
if (window.XMLHttpRequest)
|
284 |
+
{// code for IE7+, Firefox, Chrome, Opera, Safari
|
285 |
+
xmlhttp=new XMLHttpRequest();
|
286 |
+
}
|
287 |
+
else
|
288 |
+
{// code for IE6, IE5
|
289 |
+
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
|
290 |
+
}
|
291 |
+
xmlhttp.onreadystatechange=function()
|
292 |
+
{
|
293 |
+
if (xmlhttp.readyState==4 && xmlhttp.status==200)
|
294 |
+
{
|
295 |
+
document.getElementById("pls_wait").style.display='none';
|
296 |
+
document.getElementById("ajax_response_else").innerHTML=xmlhttp.responseText;
|
297 |
+
}
|
298 |
+
}
|
299 |
+
xmlhttp.open("GET",current_page+'?quote_id='+quote_id+'&weight='+weight+'&address='+address,true);
|
300 |
+
xmlhttp.send();
|
301 |
+
|
302 |
+
|
303 |
+
}
|
304 |
+
function removefreight(id){
|
305 |
+
var current_page = jQuery("#remo").val();
|
306 |
+
if (window.XMLHttpRequest)
|
307 |
+
{// code for IE7+, Firefox, Chrome, Opera, Safari
|
308 |
+
xmlhttp=new XMLHttpRequest();
|
309 |
+
}
|
310 |
+
else
|
311 |
+
{// code for IE6, IE5
|
312 |
+
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
|
313 |
+
}
|
314 |
+
xmlhttp.onreadystatechange=function()
|
315 |
+
{
|
316 |
+
if (xmlhttp.readyState==4 && xmlhttp.status==200)
|
317 |
+
{
|
318 |
+
// document.getElementById("pls_wait").style.display='none';
|
319 |
+
//document.getElementById("ajax_response_else").innerHTML=xmlhttp.responseText;
|
320 |
+
// alert(xmlhttp.responseText);
|
321 |
+
var value = xmlhttp.responseText.trim();
|
322 |
+
if(value == 'yes'){
|
323 |
+
location.reload(true);
|
324 |
+
}
|
325 |
+
}
|
326 |
+
}
|
327 |
+
xmlhttp.open("GET",current_page+'?yes='+id,true);
|
328 |
+
xmlhttp.send();
|
329 |
+
|
330 |
+
|
331 |
+
}
|
332 |
+
|
333 |
+
|
334 |
+
|
335 |
+
function apicallrateRates(){
|
336 |
+
var searchIDs = [];
|
337 |
+
jQuery(".accessories input:checkbox:checked").map(function(){
|
338 |
+
searchIDs.push(jQuery(this).val());
|
339 |
+
});
|
340 |
+
var current_page = jQuery("#current_page").val();
|
341 |
+
var quote_id = jQuery("#quote_id").val();
|
342 |
+
var weight = jQuery("#weight").val();
|
343 |
+
var address = jQuery("#address").val();
|
344 |
+
var loc_val = jQuery("#location_type").val();
|
345 |
+
document.getElementById("pls_wait").style.display='block';
|
346 |
+
document.getElementById("ajax_result").style.display='none';
|
347 |
+
if (window.XMLHttpRequest)
|
348 |
+
{// code for IE7+, Firefox, Chrome, Opera, Safari
|
349 |
+
xmlhttp=new XMLHttpRequest();
|
350 |
+
}
|
351 |
+
else
|
352 |
+
{// code for IE6, IE5
|
353 |
+
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
|
354 |
+
}
|
355 |
+
xmlhttp.onreadystatechange=function()
|
356 |
+
{
|
357 |
+
if (xmlhttp.readyState==4 && xmlhttp.status==200)
|
358 |
+
{
|
359 |
+
document.getElementById("pls_wait").style.display='none';
|
360 |
+
document.getElementById("ajax_response_else").innerHTML=xmlhttp.responseText;
|
361 |
+
}
|
362 |
+
}
|
363 |
+
xmlhttp.open("GET",current_page+'?quote_id='+quote_id+'&weight='+weight+'&address='+address+'&accessorials='+searchIDs+'&loc_val='+loc_val,true);
|
364 |
+
xmlhttp.send();
|
365 |
+
|
366 |
+
|
367 |
+
}
|
368 |
+
|
369 |
+
|
370 |
+
|
371 |
+
function apicallrate_location(val){
|
372 |
+
var current_page = jQuery("#current_page").val();
|
373 |
+
var quote_id = jQuery("#quote_id").val();
|
374 |
+
var weight = jQuery("#weight").val();
|
375 |
+
var address = jQuery("#address").val();
|
376 |
+
document.getElementById("pls_wait").style.display='block';
|
377 |
+
document.getElementById("ajax_result").style.display='none';
|
378 |
+
if(val === 'Residential') {
|
379 |
+
newaccess = '<input onclick="apicallrateRates();" id="resident1" type="checkbox" value="DEST_INSIDE_DEL" /><label for="resident1" class="access_class">Threshold Delivery</label>';
|
380 |
+
jQuery('.accessories').html(newaccess);
|
381 |
+
} else if(val === 'BusinessWithDockorForklift') {
|
382 |
+
newaccess = '<input onclick="apicallrateRates();" id="buswith1" type="checkbox" value="DEST_NOTIFY" /><label for="buswith1" class="access_class">Call before Delivery</label>\n\
|
383 |
+
<input onclick="apicallrateRates();" id="buswith2" type="checkbox" value="DEST_INSIDE_DEL" /><label for="buswith2" class="access_class">Threshold Delivery</label>\n\
|
384 |
+
<input onclick="apicallrateRates();" id="buswith3" type="checkbox" value="DEST_LIMITED_DEL" /><label for="buswith3" class="access_class">Limited Access Delivery</label>';
|
385 |
+
jQuery('.accessories').html(newaccess);
|
386 |
+
} else if(val === 'BusinessWithoutDockorForklift') {
|
387 |
+
newaccess = '<input onclick="apicallrateRates();" id="buswithout1" type="checkbox" value="DEST_NOTIFY" /><label for="buswithout1" class="access_class">Call before Delivery</label>\n\
|
388 |
+
<input onclick="apicallrateRates();" id="buswithout2" type="checkbox" value="DEST_INSIDE_DEL" /><label for="buswithout2" class="access_class">Threshold Delivery</label>\n\
|
389 |
+
<input onclick="apicallrateRates();" id="buswithout4" type="checkbox" value="DEST_LIMITED_DEL" /><label for="buswithout4" class="access_class">Limited Access Delivery</label>';
|
390 |
+
jQuery('.accessories').html(newaccess);
|
391 |
+
} else if(val === 'ConstructionSite') {
|
392 |
+
newaccess = '<input onclick="apicallrateRates();" id="const1" type="checkbox" value="DEST_LIFT_GATE" /><label for="const1" class="access_class">Lift Gate at Delivery Point</label>';
|
393 |
+
jQuery('.accessories').html(newaccess);
|
394 |
+
} else if(val === 'ConventionCenterorTradeshow') {
|
395 |
+
newaccess = '<input onclick="apicallrateRates();" id="convent1" type="checkbox" value="DEST_LIFT_GATE" /><label for="convent1" class="access_class">Lift Gate at Delivery Point</label>';
|
396 |
+
jQuery('.accessories').html(newaccess);
|
397 |
+
} else if(val === 'Terminal') {
|
398 |
+
newaccess = '<input onclick="apicallrateRates();" id="terminal1" type="checkbox" value="DEST_NOTIFY" /><label for="terminal1" class="access_class">Call before Delivery</label>';
|
399 |
+
jQuery('.accessories').html(newaccess);
|
400 |
+
}
|
401 |
+
if (window.XMLHttpRequest)
|
402 |
+
{// code for IE7+, Firefox, Chrome, Opera, Safari
|
403 |
+
xmlhttp=new XMLHttpRequest();
|
404 |
+
}
|
405 |
+
else
|
406 |
+
{// code for IE6, IE5
|
407 |
+
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
|
408 |
+
}
|
409 |
+
xmlhttp.onreadystatechange=function()
|
410 |
+
{
|
411 |
+
if (xmlhttp.readyState==4 && xmlhttp.status==200)
|
412 |
+
{
|
413 |
+
document.getElementById("pls_wait").style.display='none';
|
414 |
+
//alert(xmlhttp.responseText);
|
415 |
+
document.getElementById("ajax_response_else").innerHTML=xmlhttp.responseText;
|
416 |
+
}
|
417 |
+
}
|
418 |
+
xmlhttp.open("GET",current_page+'?quote_id='+quote_id+'&weight='+weight+'&loc_val='+val+'&address='+address,true);
|
419 |
+
xmlhttp.send();
|
420 |
+
|
421 |
+
|
422 |
+
}
|
423 |
+
|
424 |
+
function ajaxcallnew(id,pr,qote,carrier,rateid,days,grandship) {
|
425 |
+
var dest = jQuery('#location_type').val();
|
426 |
+
jQuery('#apply_rate'+id).show();
|
427 |
+
ajaxresponse = false;
|
428 |
+
var valMy = pr;
|
429 |
+
var di = id;
|
430 |
+
var quote = qote;
|
431 |
+
var car = carrier;
|
432 |
+
var rateid = rateid;
|
433 |
+
var days = days;
|
434 |
+
var grandship = grandship;
|
435 |
+
parameters={val:valMy, diq:di, qtid:quote, carname:car , dest:dest, rateid:rateid, days:days,grandship:grandship};
|
436 |
+
var url = '<?php echo $this->getUrl('freight/index/myfun'); ?>';
|
437 |
+
new Ajax.Request(url,{
|
438 |
+
parameters:parameters,
|
439 |
+
onComplete: function (transport){
|
440 |
+
jQuery('#apply_rate'+id).hide();
|
441 |
+
var response = transport.responseText.evalJSON();
|
442 |
+
alert(response);
|
443 |
+
}
|
444 |
+
});
|
445 |
+
}
|
446 |
+
|
447 |
+
function ajaxcallnew_no(id,pr,qote,carrier,rateid) {
|
448 |
+
var dest = jQuery('#location_type').val();
|
449 |
+
jQuery('#apply_rate'+id).show();
|
450 |
+
ajaxresponse = false;
|
451 |
+
var valMy = pr;
|
452 |
+
var di = id;
|
453 |
+
var quote = qote;
|
454 |
+
var car = carrier;
|
455 |
+
var rateid = rateid;
|
456 |
+
parameters={val:valMy, diq:di, qtid:quote, carname:car , dest:dest, rateid:rateid};
|
457 |
+
var url = '<?php echo $this->getUrl('freight/index/mynofun'); ?>';
|
458 |
+
new Ajax.Request(url,{
|
459 |
+
parameters:parameters,
|
460 |
+
onComplete: function (transport){
|
461 |
+
jQuery('#apply_rate'+id).hide();
|
462 |
+
var response = transport.responseText.evalJSON();
|
463 |
+
alert(response);
|
464 |
+
}
|
465 |
+
});
|
466 |
+
}
|
467 |
+
|
468 |
+
|
469 |
+
|
470 |
+
|
471 |
+
</script>
|
app/design/frontend/base/default/template/sales/order/info.phtml
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2013 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_Sales_Block_Order_Info */ ?>
|
28 |
+
<?php $_order = $this->getOrder() ?>
|
29 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
30 |
+
<div class="page-title title-buttons">
|
31 |
+
<h1><?php echo $this->__('Order #%s - %s', $_order->getRealOrderId(), $_order->getStatusLabel()) ?></h1>
|
32 |
+
<?php echo $this->getChildHtml('buttons') ?>
|
33 |
+
</div>
|
34 |
+
<?php echo $this->getStatusHistoryRssUrl($_order) ?>
|
35 |
+
<dl class="order-info">
|
36 |
+
<dt><?php echo $this->__('About This Order:') ?></dt>
|
37 |
+
<dd>
|
38 |
+
<?php $_links = $this->getLinks(); ?>
|
39 |
+
<ul id="order-info-tabs">
|
40 |
+
<?php foreach ($_links as $_link): ?>
|
41 |
+
<?php if($_link->getUrl()): ?>
|
42 |
+
<li><a href="<?php echo $_link->getUrl() ?>"><?php echo $_link->getLabel() ?></a></li>
|
43 |
+
<?php else: ?>
|
44 |
+
<li class="current"><?php echo $_link->getLabel() ?></li>
|
45 |
+
<?php endif; ?>
|
46 |
+
<?php endforeach; ?>
|
47 |
+
</ul>
|
48 |
+
<script type="text/javascript">decorateGeneric($('order-info-tabs').select('LI'),['first','last']);</script>
|
49 |
+
</dd>
|
50 |
+
</dl>
|
51 |
+
<p class="order-date"><?php echo $this->__('Order Date: %s', $this->formatDate($_order->getCreatedAtStoreDate(), 'long')) ?></p>
|
52 |
+
<?php if (!$_order->getIsVirtual()): ?>
|
53 |
+
<div class="col2-set order-info-box">
|
54 |
+
<div class="col-1">
|
55 |
+
<div class="box">
|
56 |
+
<div class="box-title">
|
57 |
+
<h2><?php echo $this->__('Shipping Address') ?></h2>
|
58 |
+
</div>
|
59 |
+
<div class="box-content">
|
60 |
+
<address><?php echo $_order->getShippingAddress()->format('html') ?></address>
|
61 |
+
</div>
|
62 |
+
</div>
|
63 |
+
</div>
|
64 |
+
<div class="col-2">
|
65 |
+
<div class="box">
|
66 |
+
<div class="box-title">
|
67 |
+
<h2><?php echo $this->__('Shipping Method') ?></h2>
|
68 |
+
</div>
|
69 |
+
<div class="box-content">
|
70 |
+
<?php if ($_order->getShippingDescription()): ?>
|
71 |
+
<?php
|
72 |
+
$items = $_order->getData();
|
73 |
+
//echo '<pre>'; print_r($items); echo '</pre>';
|
74 |
+
$ship_via_freight= $items['fee_amount'];
|
75 |
+
$ship_not_via_freight= $items['shipping_amount'];
|
76 |
+
if($ship_via_freight > 1 && $ship_not_via_freight == 0) {
|
77 |
+
echo "</br>Freight Shipping";
|
78 |
+
}
|
79 |
+
if($ship_via_freight == 0 && $ship_not_via_freight > 0) {
|
80 |
+
echo $this->escapeHtml($_order->getShippingDescription()) ;
|
81 |
+
}
|
82 |
+
if($ship_via_freight > 1 && $ship_not_via_freight > 0) {
|
83 |
+
echo $this->escapeHtml($_order->getShippingDescription()) ;
|
84 |
+
echo "</br>Freight Shipping";
|
85 |
+
}
|
86 |
+
|
87 |
+
|
88 |
+
|
89 |
+
|
90 |
+
?>
|
91 |
+
<?php else: ?>
|
92 |
+
<p><?php echo $this->helper('sales')->__('No shipping information available'); ?></p>
|
93 |
+
<?php endif; ?>
|
94 |
+
</div>
|
95 |
+
</div>
|
96 |
+
</div>
|
97 |
+
</div>
|
98 |
+
<?php endif; ?>
|
99 |
+
<div class="col2-set order-info-box">
|
100 |
+
<div class="col-1">
|
101 |
+
<div class="box">
|
102 |
+
<div class="box-title">
|
103 |
+
<h2><?php echo $this->__('Billing Address') ?></h2>
|
104 |
+
</div>
|
105 |
+
<div class="box-content">
|
106 |
+
<address><?php echo $_order->getBillingAddress()->format('html') ?></address>
|
107 |
+
</div>
|
108 |
+
</div>
|
109 |
+
</div>
|
110 |
+
<div class="col-2">
|
111 |
+
<div class="box box-payment">
|
112 |
+
<div class="box-title">
|
113 |
+
<h2><?php echo $this->__('Payment Method') ?></h2>
|
114 |
+
</div>
|
115 |
+
<div class="box-content">
|
116 |
+
<?php echo $this->getPaymentInfoHtml() ?>
|
117 |
+
</div>
|
118 |
+
</div>
|
119 |
+
</div>
|
120 |
+
</div>
|
app/design/frontend/base/default/template/sales/order/print.phtml
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php $_order = $this->getOrder() ?>
|
28 |
+
<h1><?php echo $this->__('Order #%s', $_order->getRealOrderId()) ?></h1>
|
29 |
+
<p class="order-date"><?php echo $this->__('Order Date: %s', $this->formatDate($_order->getCreatedAtStoreDate(), 'long')) ?></p>
|
30 |
+
<div class="col2-set">
|
31 |
+
<?php if (!$_order->getIsVirtual()): ?>
|
32 |
+
<div class="col-1">
|
33 |
+
<h2><?php echo $this->__('Shipping Address') ?></h2>
|
34 |
+
<address><?php echo $_order->getShippingAddress()->format('html') ?></address>
|
35 |
+
</div>
|
36 |
+
<div class="col-2">
|
37 |
+
<?php else: ?>
|
38 |
+
<div class="col-1">
|
39 |
+
<?php endif; ?>
|
40 |
+
<h2><?php echo $this->__('Billing Address') ?></h2>
|
41 |
+
<address><?php echo $_order->getBillingAddress()->format('html') ?></address>
|
42 |
+
</div>
|
43 |
+
<?php if (!$_order->getIsVirtual()): ?>
|
44 |
+
</div>
|
45 |
+
<div class="col2-set">
|
46 |
+
<div class="col-1">
|
47 |
+
<h2><?php echo $this->__('Shipping Method') ?></h2>
|
48 |
+
<?php //echo $this->escapeHtml($_order->getShippingDescription())
|
49 |
+
$items = $_order->getData();
|
50 |
+
//echo '<pre>'; print_r($items); echo '</pre>';
|
51 |
+
$ship_via_freight= $items['fee_amount'];
|
52 |
+
$ship_not_via_freight= $items['shipping_amount'];
|
53 |
+
if($ship_via_freight > 1 && $ship_not_via_freight == 0) {
|
54 |
+
echo "</br>Freight Shipping";
|
55 |
+
}
|
56 |
+
if($ship_via_freight == 0 && $ship_not_via_freight > 0) {
|
57 |
+
echo $this->escapeHtml($_order->getShippingDescription()) ;
|
58 |
+
}
|
59 |
+
if($ship_via_freight > 1 && $ship_not_via_freight > 0) {
|
60 |
+
echo $this->escapeHtml($_order->getShippingDescription()) ;
|
61 |
+
echo "</br>Freight Shipping";
|
62 |
+
}
|
63 |
+
|
64 |
+
?>
|
65 |
+
</div>
|
66 |
+
<?php endif; ?>
|
67 |
+
<div class="col-2">
|
68 |
+
<h2><?php echo $this->__('Payment Method') ?></h2>
|
69 |
+
<?php echo $this->getPaymentInfoHtml() ?>
|
70 |
+
</div>
|
71 |
+
</div>
|
72 |
+
<h2><?php echo $this->__('Items Ordered') ?></h2>
|
73 |
+
<table class="data-table" id="my-orders-table">
|
74 |
+
<col />
|
75 |
+
<col width="1" />
|
76 |
+
<col width="1" />
|
77 |
+
<col width="1" />
|
78 |
+
<col width="1" />
|
79 |
+
<thead>
|
80 |
+
<tr>
|
81 |
+
<th><?php echo $this->__('Product Name') ?></th>
|
82 |
+
<th><?php echo $this->__('SKU') ?></th>
|
83 |
+
<th class="a-right"><?php echo $this->__('Price') ?></th>
|
84 |
+
<th class="a-center"><?php echo $this->__('Qty') ?></th>
|
85 |
+
<th class="a-right"><?php echo $this->__('Subtotal') ?></th>
|
86 |
+
</tr>
|
87 |
+
</thead>
|
88 |
+
<tfoot>
|
89 |
+
<?php echo $this->getChildHtml('order_totals') ?>
|
90 |
+
</tfoot>
|
91 |
+
<?php $_items = $_order->getItemsCollection(); ?>
|
92 |
+
<?php $_count = $_items->count(); ?>
|
93 |
+
<?php foreach ($_items as $_item): ?>
|
94 |
+
<?php if ($_item->getParentItem()) continue; ?>
|
95 |
+
<tbody>
|
96 |
+
<?php echo $this->getItemHtml($_item) ?>
|
97 |
+
</tbody>
|
98 |
+
<?php endforeach; ?>
|
99 |
+
</table>
|
100 |
+
<script type="text/javascript">decorateTable('my-orders-table', {'tbody' : ['odd', 'even'], 'tbody tr' : ['first', 'last']})</script>
|
101 |
+
<script type="text/javascript">window.print();</script>
|
app/design/frontend/base/default/template/tax/checkout/discount.phtml
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
app/design/frontend/base/default/template/tax/checkout/grandtotal.phtml
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2013 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 |
+
* @var $this Mage_Tax_Block_Checkout_Grandtotal
|
28 |
+
* @see Mage_Tax_Block_Checkout_Grandtotal
|
29 |
+
*/
|
30 |
+
|
31 |
+
$currenturl = Mage::helper('core/url')->getCurrentUrl();
|
32 |
+
/*if(strstr($currenturl,'/checkout/cart/')) {
|
33 |
+
$resource = Mage::getSingleton('core/resource');
|
34 |
+
$connection = $resource->getConnection('core_write');
|
35 |
+
$session = Mage::getSingleton('checkout/session');
|
36 |
+
$quoteid = $session->getQuoteId();
|
37 |
+
|
38 |
+
$items = Mage::getSingleton('checkout/session')->getQuote()->getAllItems();
|
39 |
+
$gettotal = '';
|
40 |
+
foreach($items as $item) {
|
41 |
+
$getqty = $item->getQty();
|
42 |
+
$getid = $item->getProductId();
|
43 |
+
|
44 |
+
$select = "Select * from `brst_freight_shipping` where quote_id=$quoteid AND product_id=$getid";
|
45 |
+
$getselect = $connection->query($select);
|
46 |
+
$pro_data = $getselect->fetchAll();
|
47 |
+
if($pro_data != NULL) {
|
48 |
+
$getprice = $pro_data[0]['shipping_charge'];
|
49 |
+
$gettotal += ($getprice*$getqty);
|
50 |
+
}
|
51 |
+
}
|
52 |
+
} else {
|
53 |
+
$gettotal = '';
|
54 |
+
} */
|
55 |
+
$quote = Mage::getModel('checkout/session')->getQuote();
|
56 |
+
$cartGrossTotal = 0;
|
57 |
+
foreach ($quote->getAllItems() as $item) {
|
58 |
+
$cartGrossTotal += $item->getPriceInclTax()*$item->getQty();
|
59 |
+
|
60 |
+
}
|
61 |
+
$cartGrossTotal = number_format($cartGrossTotal, 2, '.', ',');
|
62 |
+
|
63 |
+
?>
|
64 |
+
<?php if ($this->includeTax() && $this->getTotalExclTax()>=0):?>
|
65 |
+
<tr>
|
66 |
+
<td style="<?php echo $this->getStyle() ?>" class="a-right" colspan="<?php echo $this->getColspan(); ?>">
|
67 |
+
<strong><?php echo $this->helper('tax')->__('Grand Total Excl. Tax')?></strong>
|
68 |
+
</td>
|
69 |
+
<td style="<?php echo $this->getStyle() ?>" class="a-right">
|
70 |
+
<strong><?php echo $this->helper('checkout')->formatPrice($this->getTotalExclTax()) ?></strong>
|
71 |
+
</td>
|
72 |
+
</tr>
|
73 |
+
<?php echo $this->renderTotals('taxes', $this->getColspan()); ?>
|
74 |
+
<tr>
|
75 |
+
<td style="<?php echo $this->getStyle() ?>" class="a-right" colspan="<?php echo $this->getColspan(); ?>">
|
76 |
+
<strong><?php echo $this->helper('tax')->__('Grand Total Incl. Tax')?></strong>
|
77 |
+
</td>
|
78 |
+
<td style="<?php echo $this->getStyle() ?>" class="a-right">
|
79 |
+
<strong><?php echo $this->helper('checkout')->formatPrice($this->getTotal()->getValue()) ?></strong>
|
80 |
+
</td>
|
81 |
+
</tr>
|
82 |
+
<?php else:?>
|
83 |
+
<tr>
|
84 |
+
<td style="<?php echo $this->getStyle() ?>" class="a-right" colspan="<?php echo $this->getColspan(); ?>">
|
85 |
+
<strong><?php echo $this->getTotal()->getTitle() ?></strong>
|
86 |
+
</td>
|
87 |
+
<td style="<?php echo $this->getStyle() ?>" class="a-right">
|
88 |
+
<strong><?php
|
89 |
+
if(strstr($currenturl,'/checkout/onepage/')) {
|
90 |
+
echo $this->helper('checkout')->formatPrice($this->getTotal()->getValue());
|
91 |
+
|
92 |
+
} else{
|
93 |
+
|
94 |
+
|
95 |
+
?>$<?php echo $cartGrossTotal;} ?></strong>
|
96 |
+
</td>
|
97 |
+
</tr>
|
98 |
+
<?php endif;?>
|
app/design/frontend/base/default/template/tax/checkout/shipping.phtml
ADDED
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2013 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 |
+
* @var $this Mage_Tax_Block_Checkout_Shipping
|
28 |
+
* @see Mage_Tax_Block_Checkout_Shipping
|
29 |
+
*/
|
30 |
+
?>
|
31 |
+
<?php if ($this->displayBoth()):?>
|
32 |
+
<tr>
|
33 |
+
<td style="<?php echo $this->getStyle() ?>" class="a-right" colspan="<?php echo $this->getColspan(); ?>">
|
34 |
+
<?php echo $this->getExcludeTaxLabel() ?>
|
35 |
+
</td>
|
36 |
+
<td style="<?php echo $this->getStyle() ?>" class="a-right">
|
37 |
+
<?php echo $this->helper('checkout')->formatPrice($this->getShippingExcludeTax()) ?>
|
38 |
+
</td>
|
39 |
+
</tr>
|
40 |
+
<tr>
|
41 |
+
<td style="<?php echo $this->getStyle() ?>" class="a-right" colspan="<?php echo $this->getColspan(); ?>">
|
42 |
+
<?php echo $this->getIncludeTaxLabel() ?>
|
43 |
+
</td>
|
44 |
+
<td style="<?php echo $this->getStyle() ?>" class="a-right">
|
45 |
+
<?php echo $this->helper('checkout')->formatPrice($this->getShippingIncludeTax()) ?>
|
46 |
+
</td>
|
47 |
+
</tr>
|
48 |
+
<?php elseif($this->displayIncludeTax()) : ?>
|
49 |
+
<tr>
|
50 |
+
<td style="<?php echo $this->getStyle() ?>" class="a-right" colspan="<?php echo $this->getColspan(); ?>">
|
51 |
+
<?php echo $this->getTotal()->getTitle() ?>
|
52 |
+
</td>
|
53 |
+
<td style="<?php echo $this->getStyle() ?>" class="a-right">
|
54 |
+
<?php echo $this->helper('checkout')->formatPrice($this->getShippingIncludeTax()) ?>
|
55 |
+
</td>
|
56 |
+
</tr>
|
57 |
+
<?php else:?>
|
58 |
+
|
59 |
+
<?php
|
60 |
+
|
61 |
+
$items = Mage::getSingleton('checkout/session')->getQuote()->getAllItems();
|
62 |
+
foreach($items as $item) {
|
63 |
+
$id = $item->getProductId();
|
64 |
+
$product = Mage::getModel('catalog/product')->load($id);
|
65 |
+
$ship_via_freight = $product->getData('ship_via_freight');
|
66 |
+
if($ship_via_freight == 1){
|
67 |
+
$ship_freight = 1;
|
68 |
+
}else{
|
69 |
+
$ship_via_not_freight = 0;
|
70 |
+
}
|
71 |
+
}
|
72 |
+
if($ship_via_not_freight!=1) {
|
73 |
+
?>
|
74 |
+
<tr>
|
75 |
+
<td style="<?php echo $this->getStyle() ?>" class="a-right" colspan="<?php echo $this->getColspan(); ?>">
|
76 |
+
<?php echo $this->escapeHtml($this->getTotal()->getTitle()) ?>
|
77 |
+
</td>
|
78 |
+
<td style="<?php echo $this->getStyle() ?>" class="a-right">
|
79 |
+
<?php echo $this->helper('checkout')->formatPrice($this->getShippingExcludeTax()) ?>
|
80 |
+
</td>
|
81 |
+
</tr>
|
82 |
+
<?php
|
83 |
+
}
|
84 |
+
else{
|
85 |
+
|
86 |
+
}
|
87 |
+
|
88 |
+
|
89 |
+
?>
|
90 |
+
|
91 |
+
|
92 |
+
<?php endif;?>
|
93 |
+
|
94 |
+
<?php $currenturl = Mage::helper('core/url')->getCurrentUrl();
|
95 |
+
$resource = Mage::getSingleton('core/resource');
|
96 |
+
$connection = $resource->getConnection('core_write');
|
97 |
+
$session = Mage::getSingleton('checkout/session');
|
98 |
+
$quoteid = $session->getQuoteId();
|
99 |
+
|
100 |
+
$items = Mage::getSingleton('checkout/session')->getQuote()->getAllItems();
|
101 |
+
$myPrice= '';
|
102 |
+
foreach($items as $item) {
|
103 |
+
$getid = $item->getProductId();
|
104 |
+
|
105 |
+
$select = "Select * from `brst_freight_shipping` where quote_id='$quoteid' AND product_id='$getid' AND mark = '1'";
|
106 |
+
$getselect = $connection->query($select);
|
107 |
+
$pro_data = $getselect->fetchAll();
|
108 |
+
$productid = $item->getProductId();
|
109 |
+
$proModel = Mage::getModel('catalog/product')->load($productid);
|
110 |
+
$isfreight = $proModel['ship_via_freight'];
|
111 |
+
if($pro_data != NULL) {
|
112 |
+
$getprice = $pro_data[0]['shipping_charge'];
|
113 |
+
$myPrice = $getprice + $myPrice;
|
114 |
+
|
115 |
+
$getcarrier = $pro_data[0]['carrier_name'];
|
116 |
+
|
117 |
+
}
|
118 |
+
}
|
119 |
+
$myPrice = number_format($myPrice, 2, '.', ',');
|
120 |
+
if(strstr($currenturl,'/checkout/cart')) { ?>
|
121 |
+
<!-- <tr>
|
122 |
+
<td colspan="1" class="a-right" style="width: 150px;">Freight Charges(<?php //echo $getcarrier; ?>) & Handling</td>
|
123 |
+
<td class="a-right" style=""><span class="price"><?php //echo '$'.$myPrice; ?></span></td>
|
124 |
+
</tr> -->
|
125 |
+
<?php }
|
126 |
+
//echo $ship_freight ;
|
127 |
+
if($ship_freight == 1){
|
128 |
+
if(strstr($currenturl,'/checkout/onepage/')) { ?>
|
129 |
+
<tr>
|
130 |
+
<td style="width: 350px;" colspan="3" class="a-right">Freight Charges</td>
|
131 |
+
<td class="a-right last">
|
132 |
+
<span class="price"><?php echo '$'.$myPrice; ?></span>
|
133 |
+
</td>
|
134 |
+
</tr>
|
135 |
+
<?php }
|
136 |
+
}
|
137 |
+
?>
|
app/design/frontend/base/default/template/tax/checkout/subtotal.phtml
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2013 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 |
+
* @var $this Mage_Tax_Block_Checkout_Subtotal
|
28 |
+
* @see Mage_Tax_Block_Checkout_Subtotal
|
29 |
+
*/
|
30 |
+
//$currenturl = Mage::helper('core/url')->getCurrentUrl();
|
31 |
+
//if(strstr($currenturl,'/checkout/cart/')) {
|
32 |
+
// $resource = Mage::getSingleton('core/resource');
|
33 |
+
// $connection = $resource->getConnection('core_write');
|
34 |
+
// $session = Mage::getSingleton('checkout/session');
|
35 |
+
// $quoteid = $session->getQuoteId();
|
36 |
+
//
|
37 |
+
// $items = Mage::getSingleton('checkout/session')->getQuote()->getAllItems();
|
38 |
+
// $gettotal = '';
|
39 |
+
// foreach($items as $item) {
|
40 |
+
// $getqty = $item->getQty();
|
41 |
+
// $getid = $item->getProductId();
|
42 |
+
//
|
43 |
+
// $select = "Select * from `brst_freight_shipping` where quote_id=$quoteid AND product_id=$getid";
|
44 |
+
// $getselect = $connection->query($select);
|
45 |
+
// $pro_data = $getselect->fetchAll();
|
46 |
+
// if($pro_data != NULL) {
|
47 |
+
// $getprice = $pro_data[0]['shipping_charge'];
|
48 |
+
// $gettotal += ($getprice*$getqty);
|
49 |
+
// }
|
50 |
+
// }
|
51 |
+
//} else {
|
52 |
+
// $gettotal = '';
|
53 |
+
//}
|
54 |
+
?>
|
55 |
+
<?php if ($this->displayBoth()):?>
|
56 |
+
<tr>
|
57 |
+
<td style="<?php echo $this->getStyle() ?>" class="a-right" colspan="<?php echo $this->getColspan(); ?>">
|
58 |
+
<?php echo $this->helper('tax')->__('Subtotal (Excl. Tax)') ?>
|
59 |
+
</td>
|
60 |
+
<td style="<?php echo $this->getStyle() ?>" class="a-right">
|
61 |
+
<?php echo $this->helper('checkout')->formatPrice($this->getTotal()->getValueExclTax()) ?>
|
62 |
+
</td>
|
63 |
+
</tr>
|
64 |
+
<tr>
|
65 |
+
<td style="<?php echo $this->getStyle() ?>" class="a-right" colspan="<?php echo $this->getColspan(); ?>">
|
66 |
+
<?php echo $this->helper('tax')->__('Subtotal (Incl. Tax)') ?>
|
67 |
+
</td>
|
68 |
+
<td style="<?php echo $this->getStyle() ?>" class="a-right">
|
69 |
+
<?php echo $this->helper('checkout')->formatPrice($this->getTotal()->getValueInclTax()) ?>
|
70 |
+
</td>
|
71 |
+
</tr>
|
72 |
+
<?php else : ?>
|
73 |
+
<tr>
|
74 |
+
<td style="<?php echo $this->getStyle() ?>" class="a-right" colspan="<?php echo $this->getColspan(); ?>">
|
75 |
+
<?php echo $this->getTotal()->getTitle() ?>
|
76 |
+
</td>
|
77 |
+
<td style="<?php echo $this->getStyle() ?>" class="a-right">
|
78 |
+
<?php echo $this->helper('checkout')->formatPrice($this->getTotal()->getValue()) ?>
|
79 |
+
</td>
|
80 |
+
</tr>
|
81 |
+
<?php endif;?>
|
app/design/frontend/base/default/template/tax/checkout/tax.phtml
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2013 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 |
+
* @var $this Mage_Tax_Block_Checkout_Tax
|
28 |
+
* @see Mage_Tax_Block_Checkout_Tax
|
29 |
+
*/
|
30 |
+
?>
|
31 |
+
<?php
|
32 |
+
$_value = $this->getTotal()->getValue();
|
33 |
+
$_style = $this->getTotal()->getStyle();
|
34 |
+
?>
|
35 |
+
<?php global $taxIter; $taxIter++; ?>
|
36 |
+
<?php if ($this->helper('tax')->displayFullSummary() && $_value!=0): ?>
|
37 |
+
<?php $isTop = 1; ?>
|
38 |
+
<?php foreach ($this->getTotal()->getFullInfo() as $info): ?>
|
39 |
+
<?php if (isset($info['hidden']) && $info['hidden']) continue; ?>
|
40 |
+
<?php $percent = $info['percent']; ?>
|
41 |
+
<?php $amount = $info['amount']; ?>
|
42 |
+
<?php $rates = $info['rates']; ?>
|
43 |
+
<?php $isFirst = 1; ?>
|
44 |
+
|
45 |
+
<?php foreach ($rates as $rate): ?>
|
46 |
+
<tr class="summary-details-<?php echo $taxIter; ?> summary-details<?php if ($isTop): echo ' summary-details-first'; endif; ?>" style="display:none;">
|
47 |
+
<td class="a-right" style="<?php echo $_style ?>" colspan="<?php echo $this->getColspan(); ?>">
|
48 |
+
<?php echo $this->escapeHtml($rate['title']); ?>
|
49 |
+
<?php if (!is_null($rate['percent'])): ?>
|
50 |
+
(<?php echo (float)$rate['percent']; ?>%)
|
51 |
+
<?php endif; ?>
|
52 |
+
<br />
|
53 |
+
</td>
|
54 |
+
<?php if ($isFirst): ?>
|
55 |
+
<td style="<?php echo $_style ?>" class="a-right" rowspan="<?php echo count($rates); ?>">
|
56 |
+
<?php echo $this->helper('checkout')->formatPrice($amount); ?>
|
57 |
+
</td>
|
58 |
+
<?php endif; ?>
|
59 |
+
</tr>
|
60 |
+
<?php $isFirst = 0; ?>
|
61 |
+
<?php $isTop = 0; ?>
|
62 |
+
<?php endforeach; ?>
|
63 |
+
<?php endforeach; ?>
|
64 |
+
<?php $weees = $this->getAllWeee(); ?>
|
65 |
+
<?php foreach ($weees as $weeeTitle => $weeeAmount): ?>
|
66 |
+
<tr class="summary-details-<?php echo $taxIter; ?> summary-details<?php if ($isTop): echo ' summary-details-first'; endif; ?>" style="display:none;">
|
67 |
+
<td class="a-right" style="<?php echo $_style ?>" colspan="<?php echo $this->getColspan(); ?>">
|
68 |
+
<?php echo $this->escapeHtml($weeeTitle); ?>
|
69 |
+
<br />
|
70 |
+
</td>
|
71 |
+
<td style="<?php echo $_style ?>" class="a-right" rowspan="1">
|
72 |
+
<?php echo $this->helper('checkout')->formatPrice($weeeAmount); ?>
|
73 |
+
</td>
|
74 |
+
</tr>
|
75 |
+
<?php endforeach; ?>
|
76 |
+
<?php endif;?>
|
77 |
+
<tr <?php if ($this->helper('tax')->displayFullSummary() && $_value!=0): ?> class="summary-total" onclick="expandDetails(this, '.summary-details-<?php echo $taxIter;?>')"<?php endif; ?>>
|
78 |
+
<td style="<?php echo $_style ?>" class="a-right" colspan="<?php echo $this->getColspan(); ?>">
|
79 |
+
<?php if ($this->helper('tax')->displayFullSummary()): ?>
|
80 |
+
<div class="summary-collapse"><?php echo $this->getTotal()->getTitle() ?></div>
|
81 |
+
<?php else: ?>
|
82 |
+
<?php echo $this->getTotal()->getTitle() ?>
|
83 |
+
<?php endif;?>
|
84 |
+
</td>
|
85 |
+
<td style="<?php echo $_style ?>" class="a-right"><?php echo $this->helper('checkout')->formatPrice($_value) ?></td>
|
86 |
+
</tr>
|
app/design/frontend/base/default/template/tax/order/tax.phtml
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2013 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
|
28 |
+
$_order = $this->getOrder();
|
29 |
+
$_source = $this->getSource();
|
30 |
+
$_fullInfo = $_order->getFullTaxInfo();
|
31 |
+
$_weees = $this->helper('tax')->getAllWeee($_order);
|
32 |
+
global $taxIter; $taxIter++;
|
33 |
+
$hasItemsInTaxSection = 0;
|
34 |
+
?>
|
35 |
+
<?php ?>
|
36 |
+
|
37 |
+
<?php if ($this->displayFullSummary()): ?>
|
38 |
+
<?php $isTop = 1; ?>
|
39 |
+
<?php if ($_fullInfo) foreach ($_fullInfo as $info): ?>
|
40 |
+
<?php if (isset($info['hidden']) && $info['hidden']) continue; ?>
|
41 |
+
<?php
|
42 |
+
$percent = $info['percent'];
|
43 |
+
$amount = $info['amount'];
|
44 |
+
$rates = $info['rates'];
|
45 |
+
$isFirst = 1;
|
46 |
+
?>
|
47 |
+
<?php foreach ($rates as $rate): ?>
|
48 |
+
<tr class="summary-details-<?php echo $taxIter; ?> summary-details<?php if ($isTop): echo ' summary-details-first'; endif; ?>"<?php if (!$this->getIsPlaneMode()):?> style="display:none;"<?php endif;?>>
|
49 |
+
<td <?php echo $this->getLabelProperties()?>>
|
50 |
+
<?php echo $this->escapeHtml($rate['title']); ?>
|
51 |
+
<?php if (!is_null($rate['percent'])): ?>
|
52 |
+
(<?php echo (float)$rate['percent']; ?>%)
|
53 |
+
<?php endif; ?>
|
54 |
+
<br />
|
55 |
+
</td>
|
56 |
+
<?php if ($isFirst): ?>
|
57 |
+
<td <?php echo $this->getValueProperties()?> rowspan="<?php echo count($rates); ?>">
|
58 |
+
<?php echo $_order->formatPrice($amount); ?>
|
59 |
+
</td>
|
60 |
+
<?php endif; ?>
|
61 |
+
</tr>
|
62 |
+
<?php $isFirst = 0; ?>
|
63 |
+
<?php $isTop = 0; ?>
|
64 |
+
<?php $hasItemsInTaxSection = 1 ?>
|
65 |
+
<?php endforeach; ?>
|
66 |
+
<?php endforeach; ?>
|
67 |
+
|
68 |
+
<?php foreach ($_weees as $weeeTitle => $weeeAmount): ?>
|
69 |
+
<tr class="summary-details-<?php echo $taxIter; ?> summary-details<?php if ($isTop): echo ' summary-details-first'; endif; ?>"<?php if (!$this->getIsPlaneMode()):?> style="display:none;"<?php endif;?>>
|
70 |
+
<td <?php echo $this->getLabelProperties()?>>
|
71 |
+
<?php echo $this->escapeHtml($weeeTitle); ?>
|
72 |
+
<br/>
|
73 |
+
</td>
|
74 |
+
<td <?php echo $this->getValueProperties()?> rowspan="1">
|
75 |
+
<?php echo $_order->formatPrice($weeeAmount); ?>
|
76 |
+
</td>
|
77 |
+
</tr>
|
78 |
+
<?php $hasItemsInTaxSection = 1 ?>
|
79 |
+
<?php endforeach; ?>
|
80 |
+
|
81 |
+
<?php endif;?>
|
82 |
+
|
83 |
+
<?php if ($this->displayFullSummary() && $hasItemsInTaxSection && !$this->getIsPlaneMode()): ?>
|
84 |
+
<tr class="summary-total" onclick="expandDetails(this, '.summary-details-<?php echo $taxIter;?>')">
|
85 |
+
<?php elseif ($this->displayFullSummary() && $hasItemsInTaxSection && $this->getIsPlaneMode()): ?>
|
86 |
+
<tr class="show-details">
|
87 |
+
<?php else: ?>
|
88 |
+
<tr>
|
89 |
+
<?php endif; ?>
|
90 |
+
<td <?php echo $this->getLabelProperties()?>>
|
91 |
+
<?php if ($this->displayFullSummary() && !$this->getIsPlaneMode()): ?>
|
92 |
+
<div class="summary-collapse"><?php echo $this->__('Tax'); ?></div>
|
93 |
+
<?php else: ?>
|
94 |
+
<?php echo $this->__('Tax'); ?>
|
95 |
+
<?php endif;?>
|
96 |
+
</td>
|
97 |
+
<td <?php echo $this->getValueProperties()?>><?php echo $_order->formatPrice($_source->getTaxAmount()) ?></td>
|
98 |
+
</tr>
|
app/etc/modules/Excellence_Fee.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Excellence_Fee>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</Excellence_Fee>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/etc/modules/Freightcenter_CustomWare.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Freightcenter_CustomWare>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</Freightcenter_CustomWare>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/etc/modules/Freightcenter_Frieghtadmin.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Freightcenter_Frieghtadmin>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</Freightcenter_Frieghtadmin>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/etc/modules/Freightcenter_Ship.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Freightcenter_Ship>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</Freightcenter_Ship>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/etc/modules/Freightcenters_Freight.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Freightcenters_Freight>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</Freightcenters_Freight>
|
8 |
+
</modules>
|
9 |
+
</config>
|
loctype_api.php
ADDED
@@ -0,0 +1,391 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
define('MAGENTO_ROOT', getcwd());
|
3 |
+
$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
|
4 |
+
require_once $mageFilename;
|
5 |
+
Mage::init();
|
6 |
+
$coreSession = Mage::getSingleton('core/session', array(
|
7 |
+
'name' => 'frontend'
|
8 |
+
));
|
9 |
+
$cart = Mage::getModel('checkout/cart')->getQuote();
|
10 |
+
$subtotal = Mage::helper('checkout/cart')->getQuote()->getSubtotal();
|
11 |
+
/* get attribute options */
|
12 |
+
$attribute_f = Mage::getModel('eav/config')->getAttribute('catalog_product', 'freight_class');
|
13 |
+
foreach ($attribute_f->getSource()->getAllOptions(true, true) as $opt_menuf) {
|
14 |
+
$f_attribute[$opt_menuf['value']] = $opt_menuf['label'];
|
15 |
+
}
|
16 |
+
|
17 |
+
$attribute1 = Mage::getModel('eav/config')->getAttribute('catalog_product', 'origin_warehouse');
|
18 |
+
foreach ($attribute1->getSource()->getAllOptions(true, true) as $opt_menu) {
|
19 |
+
$m1_attribute[$opt_menu['value']] = $opt_menu['label'];
|
20 |
+
}
|
21 |
+
|
22 |
+
|
23 |
+
//echo $subtotal = Mage::helper('checkout/cart')->getQuote()->getSubtotal() ;
|
24 |
+
|
25 |
+
|
26 |
+
$discount = Mage::getStoreConfig('carriers/freightcenter/discount');
|
27 |
+
if ($discount == '1') {
|
28 |
+
$discount_amount = Mage::getStoreConfig('carriers/freightcenter/discount_amount');
|
29 |
+
$discount_price = Mage::getStoreConfig('carriers/freightcenter/discount_price');
|
30 |
+
|
31 |
+
} else {
|
32 |
+
$discount_amount = $subtotal + 100;
|
33 |
+
$discount_price = '0';
|
34 |
+
}
|
35 |
+
|
36 |
+
$freightuser = Mage::getStoreConfig('carriers/freightcenter/freightuser');
|
37 |
+
$freightpwd = Mage::getStoreConfig('carriers/freightcenter/freightpwd');
|
38 |
+
$markup = Mage::getStoreConfig('carriers/freightcenter/markup');
|
39 |
+
$markup_type = Mage::getStoreConfig('carriers/freightcenter/markup_type');
|
40 |
+
$markup_price = Mage::getStoreConfig('carriers/freightcenter/markup_price');
|
41 |
+
|
42 |
+
|
43 |
+
|
44 |
+
|
45 |
+
$sandbox = Mage::getStoreConfig('carriers/freightcenter/sandbox');
|
46 |
+
/* $apishipmenturl = Mage::getStoreConfig('carriers/freightcenter/apishipmenturl');
|
47 |
+
$apicarriersurl = Mage::getStoreConfig('carriers/freightcenter/apicarriersurl');
|
48 |
+
$apirateurl = Mage::getStoreConfig('carriers/freightcenter/apirateurl'); */
|
49 |
+
if ($sandbox == '1') {
|
50 |
+
$host = "sandbox.freightcenter.com";
|
51 |
+
$apishipmenturl = "http://sandbox.freightcenter.com/v04/shipments.asmx";
|
52 |
+
$apirateurl = "http://sandbox.freightcenter.com/v04/rates.asmx";
|
53 |
+
$apicarriersurl = "http://sandbox.freightcenter.com/v04/carriers.asmx";
|
54 |
+
} else {
|
55 |
+
$host = "api.freightcenter.com";
|
56 |
+
$apishipmenturl = "http://api.freightcenter.com/v04/shipments.asmx";
|
57 |
+
$apirateurl = "http://api.freightcenter.com/v04/rates.asmx";
|
58 |
+
$apicarriersurl = "http://api.freightcenter.com/v04/carriers.asmx";
|
59 |
+
}
|
60 |
+
$myresult = array();
|
61 |
+
$ids = $_POST['proid'];
|
62 |
+
$address = $_POST['address'];
|
63 |
+
$product_location_type = $_POST['loctype'];
|
64 |
+
$quote_id = $_POST['quote'];
|
65 |
+
$loader = $_POST['img'];
|
66 |
+
$warehouse_postcode = $_POST['warehouse_postcode'];
|
67 |
+
if (isset($_POST['carrier_radio_select'])) {
|
68 |
+
$carrier_radio_select = $_POST['carrier_radio_select'];
|
69 |
+
} else {
|
70 |
+
$carrier_radio_select = 'AAACOOPER';
|
71 |
+
}
|
72 |
+
$getids = explode(';', $ids);
|
73 |
+
$codes = '';
|
74 |
+
if (isset($_POST['accessorials'])) {
|
75 |
+
$accessorials = $_POST['accessorials'];
|
76 |
+
foreach ($accessorials as $access) {
|
77 |
+
$codes .= '<string>' . $access . '</string>';
|
78 |
+
}
|
79 |
+
}
|
80 |
+
$CarrierCode = Mage::getStoreConfig('carriers/freightcenter/positions');
|
81 |
+
$Carrierdisplay = Mage::getStoreConfig('carriers/freightcenter/carrier_display');
|
82 |
+
$CarrierCode = explode(",", $CarrierCode);
|
83 |
+
//echo count($CarrierCode);
|
84 |
+
/* if( $Carrierdisplay > count($CarrierCode))
|
85 |
+
{
|
86 |
+
$Carrierdisplay = count($CarrierCode);
|
87 |
+
} */
|
88 |
+
$carriercount = count($CarrierCode);
|
89 |
+
|
90 |
+
for ($modz = 0; $modz < $carriercount; $modz++) {
|
91 |
+
|
92 |
+
$carrier_multi_rate .= " <Carrier>
|
93 |
+
<RatesRequest_Carrier>
|
94 |
+
<CarrierCode>" . $CarrierCode[$modz] . "</CarrierCode>
|
95 |
+
|
96 |
+
</RatesRequest_Carrier>
|
97 |
+
</Carrier>";
|
98 |
+
}
|
99 |
+
/* make group of products when in same warehouse */
|
100 |
+
$ware_array = array();
|
101 |
+
$cart_products = array();
|
102 |
+
foreach ($getids as $prodid) {
|
103 |
+
if ($prodid != NULL) {
|
104 |
+
$explode = explode(' ', $prodid);
|
105 |
+
$productid = $explode[0];
|
106 |
+
$qtyordered = $explode[1];
|
107 |
+
$cart_products[$productid] = $qtyordered;
|
108 |
+
$proarray = Mage::getModel('catalog/product')->load($productid);
|
109 |
+
$warehouseid = $m1_attribute[$proarray['origin_warehouse']];
|
110 |
+
|
111 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
112 |
+
$ware_query = "SELECT * FROM `brst_ship_warehouses` WHERE short_name='$warehouseid'";
|
113 |
+
$ware_results = $connection->fetchAll($ware_query);
|
114 |
+
//echo "<pre>";print_r($ware_results);exit;
|
115 |
+
if ($ware_results != NULL) {
|
116 |
+
$warehousename = $ware_results[0]['short_name'];
|
117 |
+
}
|
118 |
+
|
119 |
+
if (array_key_exists($warehousename, $ware_array)) {
|
120 |
+
array_push($ware_array[$warehousename], $proarray);
|
121 |
+
} else {
|
122 |
+
$ware_array[$warehousename] = array(
|
123 |
+
$proarray
|
124 |
+
);
|
125 |
+
}
|
126 |
+
}
|
127 |
+
}
|
128 |
+
|
129 |
+
|
130 |
+
//echo "<pre>";print_r($ware_array);exit;
|
131 |
+
$ware_count = count($ware_array);
|
132 |
+
$discount_price = $discount_price / $ware_count;
|
133 |
+
$markup_price = $markup_price / $ware_count;
|
134 |
+
foreach ($ware_array as $key => $value) {
|
135 |
+
$pro_item = '';
|
136 |
+
foreach ($value as $mainarray) {
|
137 |
+
$pro_model = $mainarray;
|
138 |
+
$proid = $pro_model['entity_id'];
|
139 |
+
$des = str_replace(' ', '', $pro_model['description']);
|
140 |
+
$flen = $pro_model['freight_length'];
|
141 |
+
$fwidth = $pro_model['freight_width'];
|
142 |
+
$fheight = $pro_model['freight_height'];
|
143 |
+
$nmfc = $pro_model['nmfc'];
|
144 |
+
$quantity = $cart_products[$proid];
|
145 |
+
$weight = ($pro_model['weight'] * $quantity);
|
146 |
+
|
147 |
+
$fclass = $f_attribute[$pro_model['freight_class']];
|
148 |
+
$ware_id = $m1_attribute[$pro_model['origin_warehouse']];
|
149 |
+
|
150 |
+
$resource = Mage::getSingleton('core/resource');
|
151 |
+
$readConnection = $resource->getConnection('core_read');
|
152 |
+
$tableNamep = $resource->getTableName('brst_ship_warehouses');
|
153 |
+
$queryp = "SELECT * FROM $tableNamep WHERE short_name ='$ware_id'";
|
154 |
+
$results = $readConnection->fetchAll($queryp);
|
155 |
+
//echo "<pre>";print_r($results);exit;
|
156 |
+
foreach ($results as $ware_result) {
|
157 |
+
$warehouse_location_type = str_replace(' ', '', $ware_result['location_type']);
|
158 |
+
$warehouse_postcode = $ware_result['cmpny_postcode'];
|
159 |
+
$accessorials = $ware_result['accessorials'];
|
160 |
+
$accessorials = explode(',', $accessorials);
|
161 |
+
//print_r($accessorials);
|
162 |
+
$accessorialsdisplay = count($accessorials);
|
163 |
+
$print_accessorials = '';
|
164 |
+
for ($modz = 0; $modz < $accessorialsdisplay; $modz++) {
|
165 |
+
|
166 |
+
//$print_accessorials ="<p>".$accessorials[$modz]."</p>"
|
167 |
+
if ($accessorials[$modz] == '1') {
|
168 |
+
$print_accessorials .= "<string>ORIGIN_LIFT_GATE</string>";
|
169 |
+
}
|
170 |
+
if ($accessorials[$modz] == '2') {
|
171 |
+
$print_accessorials .= "<string>ORIGIN_LIMITED_PU</string>";
|
172 |
+
}
|
173 |
+
if ($accessorials[$modz] == '3') {
|
174 |
+
$print_accessorials .= "<string>ORIGIN_INSIDE_PU</string>";
|
175 |
+
}
|
176 |
+
if ($accessorials[$modz] == '4') {
|
177 |
+
$print_accessorials .= "<string>ORIGIN_CALL_FOR_APPT</string>";
|
178 |
+
}
|
179 |
+
}
|
180 |
+
//ECHO $codes$print_accessorials;
|
181 |
+
}
|
182 |
+
|
183 |
+
$pro_item .= '<RatesRequest_Item>
|
184 |
+
<Description>' . $des . '</Description>
|
185 |
+
<PackagingCode>Palletized</PackagingCode>
|
186 |
+
<Quantity>' . $quantity . '</Quantity>
|
187 |
+
<LinearFeet>0</LinearFeet>
|
188 |
+
<Dimensions>
|
189 |
+
<Length>' . $flen . '</Length>
|
190 |
+
<Width>' . $fwidth . '</Width>
|
191 |
+
<Height>' . $fheight . '</Height>
|
192 |
+
<UnitOfMeasure>IN</UnitOfMeasure>
|
193 |
+
</Dimensions>
|
194 |
+
<FreightClass>' . $fclass . '</FreightClass>
|
195 |
+
<Weight>
|
196 |
+
<WeightAmt>' . $weight . '</WeightAmt>
|
197 |
+
<UnitOfMeasure>LBS</UnitOfMeasure>
|
198 |
+
</Weight>
|
199 |
+
<Nmfc>' . $nmfc . '</Nmfc>
|
200 |
+
</RatesRequest_Item>';
|
201 |
+
|
202 |
+
}
|
203 |
+
|
204 |
+
/* send api request */
|
205 |
+
$xml = '<?xml version="1.0" encoding="utf-8"?>
|
206 |
+
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
|
207 |
+
<soap12:Body>
|
208 |
+
<GetRates xmlns="http://freightcenter.com/API/V04/">
|
209 |
+
<request>
|
210 |
+
<LicenseKey>3BDA740C-FF39-4BDC-AB49-B0A3C08E23B4</LicenseKey>
|
211 |
+
<Username>'.$freightuser.'</Username>
|
212 |
+
<Password>'.$freightpwd.'</Password>
|
213 |
+
<OriginPostalCode>' . $warehouse_postcode . '</OriginPostalCode>
|
214 |
+
<OriginLocationType>' . $warehouse_location_type . '</OriginLocationType>
|
215 |
+
<DestinationPostalCode>' . $address . '</DestinationPostalCode>
|
216 |
+
<DestinationLocationType>' . $product_location_type . '</DestinationLocationType>
|
217 |
+
<Items>' . $pro_item . '</Items>
|
218 |
+
<Accessorials>' . $codes . '' . $print_accessorials . '</Accessorials>
|
219 |
+
<Filters>
|
220 |
+
<Mode>LTL</Mode>
|
221 |
+
<IncludeWhiteGlove>false</IncludeWhiteGlove>
|
222 |
+
<IncludeMotorcycleRates>false</IncludeMotorcycleRates>
|
223 |
+
<CarrierFilter>
|
224 |
+
<CarrierFilterType>INCLUDE</CarrierFilterType>
|
225 |
+
' . $carrier_multi_rate . '
|
226 |
+
</CarrierFilter>
|
227 |
+
</Filters>
|
228 |
+
</request>
|
229 |
+
</GetRates>
|
230 |
+
</soap12:Body>
|
231 |
+
</soap12:Envelope>';
|
232 |
+
//print_r($xml);
|
233 |
+
$apiurl = $apirateurl;
|
234 |
+
$headers = array(
|
235 |
+
"POST /V04/rates.asmx HTTP/1.1",
|
236 |
+
"Host: " . $host . "",
|
237 |
+
"Content-Type: text/xml; charset=utf-8",
|
238 |
+
"Content-length: " . strlen($xml)
|
239 |
+
);
|
240 |
+
|
241 |
+
/* send curl request to get active carriers */
|
242 |
+
$soap_do = curl_init();
|
243 |
+
curl_setopt($soap_do, CURLOPT_URL, $apiurl);
|
244 |
+
curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true);
|
245 |
+
curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false);
|
246 |
+
curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false);
|
247 |
+
curl_setopt($soap_do, CURLOPT_POST, true);
|
248 |
+
curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 0);
|
249 |
+
curl_setopt($soap_do, CURLOPT_TIMEOUT, 400);
|
250 |
+
curl_setopt($soap_do, CURLOPT_HTTPHEADER, $headers);
|
251 |
+
curl_setopt($soap_do, CURLOPT_POSTFIELDS, $xml);
|
252 |
+
|
253 |
+
$result = curl_exec($soap_do);
|
254 |
+
|
255 |
+
curl_close($soap_do);
|
256 |
+
|
257 |
+
$p = xml_parser_create();
|
258 |
+
xml_parse_into_struct($p, $result, $vals, $index);
|
259 |
+
xml_parser_free($p);
|
260 |
+
// echo "<pre>";print_r($vals);
|
261 |
+
$yes = "'yes'";
|
262 |
+
if ($vals['5']['value'] == 'ERROR') {
|
263 |
+
$response = '<div><p>
|
264 |
+
There was a problem with the freight. Do you want to check-out with only non-freight products?
|
265 |
+
</p>
|
266 |
+
<button onclick="removefreight(' . $yes . ')" class="button" title="Remove Freight Products" type="button"><span><span>Yes</span></span></button></div>';
|
267 |
+
|
268 |
+
} else if ($vals['5']['value'] == 'WARNING') {
|
269 |
+
$response = '<div><p>
|
270 |
+
There was a problem with the freight. Do you want to check-out with only non-freight products?
|
271 |
+
</p>
|
272 |
+
<button onclick="removefreight(' . $yes . ')" class="button" title="Remove Freight Products" type="button"><span><span>Yes</span></span></button></div>';
|
273 |
+
} else if (empty($vals)) {
|
274 |
+
$response = '<div><p>
|
275 |
+
There was a problem with the freight. Do you want to check-out with only non-freight products?
|
276 |
+
</p>
|
277 |
+
<button onclick="removefreight(' . $yes . ')" class="button" title="Remove Freight Products" type="button"><span><span>Yes</span></span></button></div>';
|
278 |
+
|
279 |
+
|
280 |
+
} else {
|
281 |
+
$xmlResponseArray = array();
|
282 |
+
foreach ($vals as $charges) {
|
283 |
+
|
284 |
+
if (in_array("TOTALCHARGE", $charges)) {
|
285 |
+
$xmlResponseArray['TOTALCHARGE'][] = $charges['value'];
|
286 |
+
}
|
287 |
+
if (in_array("SERVICENAME", $charges)) {
|
288 |
+
$xmlResponseArray['SERVICENAME'][] = $charges['value'];
|
289 |
+
}
|
290 |
+
if (in_array("SERVICEDAYS", $charges)) {
|
291 |
+
$xmlResponseArray['SERVICEDAYS'][] = $charges['value'];
|
292 |
+
}
|
293 |
+
if (in_array("RATEID", $charges)) {
|
294 |
+
$xmlResponseArray['RATEID'][] = $charges['value'];
|
295 |
+
}
|
296 |
+
}
|
297 |
+
$xmlResponse = array();
|
298 |
+
$countedCharges = count($xmlResponseArray['TOTALCHARGE']);
|
299 |
+
if($subtotal > $discount_amount){
|
300 |
+
$Carrierd = 1;
|
301 |
+
}else{
|
302 |
+
$Carrierd = $Carrierdisplay;
|
303 |
+
}
|
304 |
+
for ($j = 0; $j < $Carrierd; $j++) {
|
305 |
+
$xmlResponse[$j][] = $xmlResponseArray['TOTALCHARGE'][$j];
|
306 |
+
$xmlResponse[$j][] = $xmlResponseArray['SERVICENAME'][$j];
|
307 |
+
$xmlResponse[$j][] = $xmlResponseArray['SERVICEDAYS'][$j];
|
308 |
+
$xmlResponse[$j][] = $xmlResponseArray['RATEID'][$j];
|
309 |
+
}
|
310 |
+
$response = '';
|
311 |
+
foreach ($xmlResponse as $xmlResponse2) {
|
312 |
+
|
313 |
+
$total_charge = $xmlResponse2[0];
|
314 |
+
$carriers_value = $xmlResponse2[1];
|
315 |
+
$business_day = $xmlResponse2[2];
|
316 |
+
$RATEID = $xmlResponse2[3];
|
317 |
+
if ($total_charge == '') {
|
318 |
+
} else {
|
319 |
+
if ($carriers_value == NULL) {
|
320 |
+
$response = "No Result Found, Please try another Carrier";
|
321 |
+
} else {
|
322 |
+
/* if($subtotal > $discount_amount){
|
323 |
+
if($total_charge < $discount_price){
|
324 |
+
} else{
|
325 |
+
$total_charge = $discount_price;
|
326 |
+
}
|
327 |
+
|
328 |
+
} */
|
329 |
+
if ($markup == 'none') {
|
330 |
+
//$gettotal = $myPrice;
|
331 |
+
$gettotal = $total_charge;
|
332 |
+
}
|
333 |
+
|
334 |
+
if ($markup == 'markup') {
|
335 |
+
$gettotal = $total_charge;
|
336 |
+
if ($markup_type == 'percent') {
|
337 |
+
$markup_price = Mage::getStoreConfig('carriers/freightcenter/markup_price');
|
338 |
+
$gettotal_pr = ($gettotal * $markup_price) / 100;
|
339 |
+
$gettotal = $gettotal + $gettotal_pr;
|
340 |
+
|
341 |
+
} else {
|
342 |
+
//$markup_price = Mage::getStoreConfig('carriers/freightcenter/markup_price');
|
343 |
+
$gettotal = $gettotal + $markup_price;
|
344 |
+
|
345 |
+
}
|
346 |
+
}
|
347 |
+
|
348 |
+
if ($markup == 'discount') {
|
349 |
+
$gettotal = $total_charge;
|
350 |
+
if ($markup_type == 'percent') {
|
351 |
+
$markup_price = Mage::getStoreConfig('carriers/freightcenter/markup_price');
|
352 |
+
$gettotal_pr = ($gettotal * $markup_price) / 100;
|
353 |
+
$gettotal = $gettotal - $gettotal_pr;
|
354 |
+
} else {
|
355 |
+
//$markup_price = Mage::getStoreConfig('carriers/freightcenter/markup_price');
|
356 |
+
$gettotal = $gettotal - $markup_price;
|
357 |
+
}
|
358 |
+
}
|
359 |
+
|
360 |
+
if ($gettotal < $total_charge) {
|
361 |
+
$discount_get = $total_charge - $gettotal;
|
362 |
+
$discount_get = number_format($discount_get, 2, '.', ',');
|
363 |
+
$discount_ge = '</br>Discount: -$' . $discount_get;
|
364 |
+
|
365 |
+
$total = ' </br>Cost: $' . number_format($total_charge, 2, '.', ',');
|
366 |
+
} else if ($gettotal < $total_charge) {
|
367 |
+
$gettotal = $total_charge;
|
368 |
+
//$gettotal = number_format($gettotal, 2, '.', ',');
|
369 |
+
}
|
370 |
+
|
371 |
+
$response .= '<div class="ajax-result" id="ajax_result' . $proid . '"><table>
|
372 |
+
<tr>
|
373 |
+
<td width="20"><input type="radio" class="ajax" value="ajax_response" name="shipping' . $proid . '" onclick="ajaxcallnew(' . $proid . ',' . $gettotal . ',' . $quote_id . ',' . "'$carriers_value'" . ',' . "'$RATEID'" . ',' . "'$business_day'" . ');" id="ajax' . $proid . '" /></td>
|
374 |
+
<td><label for="ajax' . $proid . '"><span style="font-weight:bold;">' . $carriers_value . '</span> <span style="display:none;" id="apply_rate' . $proid . '"><img class="v-middle" title="Applying Carrier Rate..." alt="Applying Carrier Rate..." src="' . $loader . '" /></span></label><br/>Estimated Transit Time: ' . $business_day . ' Business days ' . $total . ' ' . $discount_ge . '</br>You Pay: $' . number_format($gettotal, 2, '.', ',') . '</td>
|
375 |
+
</tr>
|
376 |
+
</table>
|
377 |
+
<div style="clear:both;height:16px;"></div>
|
378 |
+
</div>';
|
379 |
+
|
380 |
+
}
|
381 |
+
}
|
382 |
+
|
383 |
+
}
|
384 |
+
}
|
385 |
+
$myresult[$proid] = $response;
|
386 |
+
}
|
387 |
+
$response = '';
|
388 |
+
//echo "<pre>";print_r($myresult);exit;
|
389 |
+
$gotresult['rates'] = $myresult;
|
390 |
+
echo json_encode($gotresult);
|
391 |
+
exit;
|
loctype_api_one.php
ADDED
@@ -0,0 +1,452 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
define('MAGENTO_ROOT', getcwd());
|
3 |
+
$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
|
4 |
+
require_once $mageFilename;
|
5 |
+
Mage::init();
|
6 |
+
$coreSession = Mage::getSingleton('core/session', array('name' => 'frontend'));
|
7 |
+
$cart = Mage::getModel('checkout/cart')->getQuote();
|
8 |
+
$subtotal = Mage::helper('checkout/cart')->getQuote()->getSubtotal() ;
|
9 |
+
/* get attribute options */
|
10 |
+
$attribute_f = Mage::getModel('eav/config')->getAttribute('catalog_product', 'freight_class');
|
11 |
+
foreach ( $attribute_f->getSource()->getAllOptions(true, true) as $opt_menuf)
|
12 |
+
{
|
13 |
+
$f_attribute[$opt_menuf['value']] = $opt_menuf['label'];
|
14 |
+
}
|
15 |
+
|
16 |
+
$attribute1 = Mage::getModel('eav/config')->getAttribute('catalog_product', 'origin_warehouse');
|
17 |
+
foreach ( $attribute1->getSource()->getAllOptions(true, true) as $opt_menu)
|
18 |
+
{
|
19 |
+
$m1_attribute[$opt_menu['value']] = $opt_menu['label'];
|
20 |
+
}
|
21 |
+
|
22 |
+
|
23 |
+
//echo $subtotal = Mage::helper('checkout/cart')->getQuote()->getSubtotal() ;
|
24 |
+
|
25 |
+
|
26 |
+
$discount = Mage::getStoreConfig('carriers/freightcenter/discount');
|
27 |
+
if($discount == '1'){
|
28 |
+
$discount_amount = Mage::getStoreConfig('carriers/freightcenter/discount_amount');
|
29 |
+
$discount_price = Mage::getStoreConfig('carriers/freightcenter/discount_price');
|
30 |
+
|
31 |
+
}
|
32 |
+
else{
|
33 |
+
$discount_amount = $subtotal + 100;
|
34 |
+
$discount_price = '0';
|
35 |
+
}
|
36 |
+
$freightuser = Mage::getStoreConfig('carriers/freightcenter/freightuser');
|
37 |
+
$freightpwd = Mage::getStoreConfig('carriers/freightcenter/freightpwd');
|
38 |
+
$markup = Mage::getStoreConfig('carriers/freightcenter/markup');
|
39 |
+
$markup_type = Mage::getStoreConfig('carriers/freightcenter/markup_type');
|
40 |
+
$markup_price = Mage::getStoreConfig('carriers/freightcenter/markup_price');
|
41 |
+
|
42 |
+
|
43 |
+
|
44 |
+
|
45 |
+
$sandbox = Mage::getStoreConfig('carriers/freightcenter/sandbox');
|
46 |
+
/* $apishipmenturl = Mage::getStoreConfig('carriers/freightcenter/apishipmenturl');
|
47 |
+
$apicarriersurl = Mage::getStoreConfig('carriers/freightcenter/apicarriersurl');
|
48 |
+
$apirateurl = Mage::getStoreConfig('carriers/freightcenter/apirateurl'); */
|
49 |
+
if($sandbox == '1'){
|
50 |
+
$host = "sandbox.freightcenter.com";
|
51 |
+
$apishipmenturl = "http://sandbox.freightcenter.com/v04/shipments.asmx";
|
52 |
+
$apirateurl = "http://sandbox.freightcenter.com/v04/rates.asmx";
|
53 |
+
$apicarriersurl = "http://sandbox.freightcenter.com/v04/carriers.asmx";
|
54 |
+
}
|
55 |
+
else{
|
56 |
+
$host = "api.freightcenter.com";
|
57 |
+
$apishipmenturl = "http://api.freightcenter.com/v04/shipments.asmx";
|
58 |
+
$apirateurl = "http://api.freightcenter.com/v04/rates.asmx";
|
59 |
+
$apicarriersurl = "http://api.freightcenter.com/v04/carriers.asmx";
|
60 |
+
}
|
61 |
+
$myresult = array();
|
62 |
+
$ids = $_POST['proid'];
|
63 |
+
$address = $_POST['address'];
|
64 |
+
$product_location_type = $_POST['loctype'];
|
65 |
+
$quote_id = $_POST['quote'];
|
66 |
+
$loader = $_POST['img'];
|
67 |
+
$warehouse_postcode = $_POST['warehouse_postcode'];
|
68 |
+
if(isset($_POST['carrier_radio_select'])) {
|
69 |
+
$carrier_radio_select = $_POST['carrier_radio_select'];
|
70 |
+
} else {
|
71 |
+
$carrier_radio_select = 'AAACOOPER';
|
72 |
+
}
|
73 |
+
$getids = explode(';',$ids);
|
74 |
+
$codes = '';
|
75 |
+
if(isset($_POST['accessorials'])) {
|
76 |
+
$accessorials = $_POST['accessorials'];
|
77 |
+
foreach ($accessorials as $access) {
|
78 |
+
$codes .= '<string>'.$access.'</string>';
|
79 |
+
}
|
80 |
+
}
|
81 |
+
$CarrierCode = Mage::getStoreConfig('carriers/freightcenter/positions');
|
82 |
+
$Carrierdisplay = Mage::getStoreConfig('carriers/freightcenter/carrier_display');
|
83 |
+
$CarrierCode = explode("," , $CarrierCode);
|
84 |
+
//echo count($CarrierCode);
|
85 |
+
/* if( $Carrierdisplay > count($CarrierCode))
|
86 |
+
{
|
87 |
+
$Carrierdisplay = count($CarrierCode);
|
88 |
+
}
|
89 |
+
*/
|
90 |
+
$carriercount = count($CarrierCode);
|
91 |
+
for($modz=0;$modz<$carriercount; $modz++){
|
92 |
+
|
93 |
+
$carrier_multi_rate .= " <Carrier>
|
94 |
+
<RatesRequest_Carrier>
|
95 |
+
<CarrierCode>".$CarrierCode[$modz]."</CarrierCode>
|
96 |
+
|
97 |
+
</RatesRequest_Carrier>
|
98 |
+
</Carrier>" ;
|
99 |
+
}
|
100 |
+
/* make group of products when in same warehouse */
|
101 |
+
$ware_array = array();
|
102 |
+
$cart_products = array();
|
103 |
+
foreach($getids as $prodid) {
|
104 |
+
if($prodid != NULL) {
|
105 |
+
$explode = explode(' ',$prodid);
|
106 |
+
$productid = $explode[0];
|
107 |
+
$qtyordered = $explode[1];
|
108 |
+
$cart_products[$productid] = $qtyordered;
|
109 |
+
$proarray = Mage::getModel('catalog/product')->load($productid);
|
110 |
+
$warehouseid = $m1_attribute[$proarray['origin_warehouse']];
|
111 |
+
|
112 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
113 |
+
$ware_query = "SELECT * FROM `brst_ship_warehouses` WHERE short_name='$warehouseid'";
|
114 |
+
$ware_results = $connection->fetchAll($ware_query);
|
115 |
+
//echo "<pre>";print_r($ware_results);exit;
|
116 |
+
if($ware_results != NULL) {
|
117 |
+
$warehousename = $ware_results[0]['short_name'];
|
118 |
+
}
|
119 |
+
|
120 |
+
if (array_key_exists($warehousename, $ware_array)) {
|
121 |
+
array_push($ware_array[$warehousename],$proarray);
|
122 |
+
} else {
|
123 |
+
$ware_array[$warehousename] = array($proarray);
|
124 |
+
}
|
125 |
+
}
|
126 |
+
}
|
127 |
+
|
128 |
+
|
129 |
+
//echo "<pre>";print_r($ware_array);exit;
|
130 |
+
$ware_count = count($ware_array);
|
131 |
+
$discount_price = $discount_price/$ware_count;
|
132 |
+
$markup_price = $markup_price/$ware_count;
|
133 |
+
foreach($ware_array as $key=>$value) {
|
134 |
+
$pro_item = '';
|
135 |
+
foreach($value as $mainarray) {
|
136 |
+
$pro_model = $mainarray;
|
137 |
+
$proid = $pro_model['entity_id'];
|
138 |
+
$des = str_replace(' ','',$pro_model['description']);
|
139 |
+
$flen = $pro_model['freight_length'];
|
140 |
+
$fwidth = $pro_model['freight_width'];
|
141 |
+
$fheight = $pro_model['freight_height'];
|
142 |
+
$nmfc = $pro_model['nmfc'];
|
143 |
+
$quantity = $cart_products[$proid];
|
144 |
+
$weight = ($pro_model['weight'] * $quantity);
|
145 |
+
|
146 |
+
$fclass = $f_attribute[$pro_model['freight_class']];
|
147 |
+
$ware_id = $m1_attribute[$pro_model['origin_warehouse']];
|
148 |
+
|
149 |
+
$resource = Mage::getSingleton('core/resource');
|
150 |
+
$readConnection = $resource->getConnection('core_read');
|
151 |
+
$tableNamep = $resource->getTableName('brst_ship_warehouses');
|
152 |
+
$queryp = "SELECT * FROM $tableNamep WHERE short_name ='$ware_id'" ;
|
153 |
+
$results = $readConnection->fetchAll($queryp);
|
154 |
+
//echo "<pre>";print_r($results);exit;
|
155 |
+
foreach($results as $ware_result)
|
156 |
+
{
|
157 |
+
$warehouse_location_type = str_replace(' ','',$ware_result['location_type']);
|
158 |
+
$warehouse_postcode = $ware_result['cmpny_postcode'];
|
159 |
+
$accessorials = $ware_result['accessorials'];
|
160 |
+
$accessorials = explode(',', $accessorials);
|
161 |
+
//print_r($accessorials);
|
162 |
+
$accessorialsdisplay = count($accessorials);
|
163 |
+
$print_accessorials = '';
|
164 |
+
for($modz=0;$modz<$accessorialsdisplay; $modz++){
|
165 |
+
|
166 |
+
//$print_accessorials ="<p>".$accessorials[$modz]."</p>"
|
167 |
+
if($accessorials[$modz] == '1'){
|
168 |
+
$print_accessorials .="<string>ORIGIN_LIFT_GATE</string>" ;
|
169 |
+
}
|
170 |
+
if($accessorials[$modz] == '2'){
|
171 |
+
$print_accessorials .="<string>ORIGIN_LIMITED_PU</string>" ;
|
172 |
+
}
|
173 |
+
if($accessorials[$modz] == '3'){
|
174 |
+
$print_accessorials .="<string>ORIGIN_INSIDE_PU</string>" ;
|
175 |
+
}
|
176 |
+
if($accessorials[$modz] == '4'){
|
177 |
+
$print_accessorials .="<string>ORIGIN_CALL_FOR_APPT</string>" ;
|
178 |
+
}
|
179 |
+
}
|
180 |
+
//ECHO $codes$print_accessorials;
|
181 |
+
}
|
182 |
+
|
183 |
+
$pro_item .= '<RatesRequest_Item>
|
184 |
+
<Description>'.$des.'</Description>
|
185 |
+
<PackagingCode>Palletized</PackagingCode>
|
186 |
+
<Quantity>'.$quantity.'</Quantity>
|
187 |
+
<LinearFeet>0</LinearFeet>
|
188 |
+
<Dimensions>
|
189 |
+
<Length>'.$flen.'</Length>
|
190 |
+
<Width>'.$fwidth.'</Width>
|
191 |
+
<Height>'.$fheight.'</Height>
|
192 |
+
<UnitOfMeasure>IN</UnitOfMeasure>
|
193 |
+
</Dimensions>
|
194 |
+
<FreightClass>'.$fclass.'</FreightClass>
|
195 |
+
<Weight>
|
196 |
+
<WeightAmt>'.$weight.'</WeightAmt>
|
197 |
+
<UnitOfMeasure>LBS</UnitOfMeasure>
|
198 |
+
</Weight>
|
199 |
+
<Nmfc>'.$nmfc.'</Nmfc>
|
200 |
+
</RatesRequest_Item>';
|
201 |
+
|
202 |
+
}
|
203 |
+
|
204 |
+
/* send api request */
|
205 |
+
$xml='<?xml version="1.0" encoding="utf-8"?>
|
206 |
+
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
|
207 |
+
<soap12:Body>
|
208 |
+
<GetRates xmlns="http://freightcenter.com/API/V04/">
|
209 |
+
<request>
|
210 |
+
<LicenseKey>3BDA740C-FF39-4BDC-AB49-B0A3C08E23B4</LicenseKey>
|
211 |
+
<Username>'.$freightuser.'</Username>
|
212 |
+
<Password>'.$freightpwd.'</Password>
|
213 |
+
<OriginPostalCode>'.$warehouse_postcode.'</OriginPostalCode>
|
214 |
+
<OriginLocationType>'.$warehouse_location_type.'</OriginLocationType>
|
215 |
+
<DestinationPostalCode>'.$address.'</DestinationPostalCode>
|
216 |
+
<DestinationLocationType>'.$product_location_type.'</DestinationLocationType>
|
217 |
+
<Items>'.$pro_item.'</Items>
|
218 |
+
<Accessorials>'.$codes.''.$print_accessorials.'</Accessorials>
|
219 |
+
<Filters>
|
220 |
+
<Mode>LTL</Mode>
|
221 |
+
<IncludeWhiteGlove>false</IncludeWhiteGlove>
|
222 |
+
<IncludeMotorcycleRates>false</IncludeMotorcycleRates>
|
223 |
+
<CarrierFilter>
|
224 |
+
<CarrierFilterType>INCLUDE</CarrierFilterType>
|
225 |
+
'.$carrier_multi_rate.'
|
226 |
+
</CarrierFilter>
|
227 |
+
</Filters>
|
228 |
+
</request>
|
229 |
+
</GetRates>
|
230 |
+
</soap12:Body>
|
231 |
+
</soap12:Envelope>';
|
232 |
+
|
233 |
+
$apiurl = $apirateurl;
|
234 |
+
$headers = array(
|
235 |
+
"POST /V04/rates.asmx HTTP/1.1",
|
236 |
+
"Host: ".$host."",
|
237 |
+
"Content-Type: text/xml; charset=utf-8",
|
238 |
+
"Content-length: ".strlen($xml)
|
239 |
+
);
|
240 |
+
|
241 |
+
/* send curl request to get active carriers */
|
242 |
+
$soap_do = curl_init();
|
243 |
+
curl_setopt($soap_do, CURLOPT_URL, $apiurl );
|
244 |
+
curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true );
|
245 |
+
curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false);
|
246 |
+
curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false);
|
247 |
+
curl_setopt($soap_do, CURLOPT_POST, true );
|
248 |
+
curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT ,0);
|
249 |
+
curl_setopt($soap_do, CURLOPT_TIMEOUT, 400);
|
250 |
+
curl_setopt($soap_do, CURLOPT_HTTPHEADER, $headers);
|
251 |
+
curl_setopt($soap_do, CURLOPT_POSTFIELDS, $xml);
|
252 |
+
|
253 |
+
$result = curl_exec($soap_do);
|
254 |
+
|
255 |
+
curl_close($soap_do);
|
256 |
+
|
257 |
+
$p = xml_parser_create();
|
258 |
+
xml_parse_into_struct($p, $result, $vals, $index);
|
259 |
+
xml_parser_free($p);
|
260 |
+
// echo "<pre>";print_r($vals);
|
261 |
+
$yes = "'yes'";
|
262 |
+
if($vals['5']['value'] == 'ERROR'){
|
263 |
+
$response = '<div><p>
|
264 |
+
There was a problem with the freight. Do you want to check-out with only non-freight products?
|
265 |
+
</p>
|
266 |
+
<button onclick="removefreight('.$yes.')" class="button" title="Remove Freight Products" type="button"><span><span>Yes</span></span></button></div>';
|
267 |
+
|
268 |
+
}
|
269 |
+
else if($vals['5']['value'] == 'WARNING'){
|
270 |
+
$response = '<div><p>
|
271 |
+
There was a problem with the freight. Do you want to check-out with only non-freight products?
|
272 |
+
</p>
|
273 |
+
<button onclick="removefreight('.$yes.')" class="button" title="Remove Freight Products" type="button"><span><span>Yes</span></span></button></div>';
|
274 |
+
}
|
275 |
+
else if(empty($vals)){
|
276 |
+
$response = '<div><p>
|
277 |
+
There was a problem with the freight. Do you want to check-out with only non-freight products?
|
278 |
+
</p>
|
279 |
+
<button onclick="removefreight('.$yes.')" class="button" title="Remove Freight Products" type="button"><span><span>Yes</span></span></button></div>';
|
280 |
+
|
281 |
+
|
282 |
+
}
|
283 |
+
else{
|
284 |
+
|
285 |
+
$xmlResponseArray = array();
|
286 |
+
foreach($vals as $charges){
|
287 |
+
|
288 |
+
if (in_array("TOTALCHARGE", $charges)) {
|
289 |
+
$xmlResponseArray['TOTALCHARGE'][] = $charges['value'];
|
290 |
+
}
|
291 |
+
if (in_array("SERVICENAME", $charges)) {
|
292 |
+
$xmlResponseArray['SERVICENAME'][] = $charges['value'];
|
293 |
+
}
|
294 |
+
if (in_array("SERVICEDAYS", $charges)) {
|
295 |
+
$xmlResponseArray['SERVICEDAYS'][] = $charges['value'];
|
296 |
+
}
|
297 |
+
if (in_array("RATEID", $charges)) {
|
298 |
+
$xmlResponseArray['RATEID'][] = $charges['value'];
|
299 |
+
}
|
300 |
+
}
|
301 |
+
$xmlResponse = array();
|
302 |
+
$countedCharges = count($xmlResponseArray['TOTALCHARGE']);
|
303 |
+
if($subtotal > $discount_amount){
|
304 |
+
$Carrierd = 1;
|
305 |
+
}else{
|
306 |
+
$Carrierd = $Carrierdisplay;
|
307 |
+
}
|
308 |
+
|
309 |
+
for($j=0;$j<$Carrierd;$j++){
|
310 |
+
$xmlResponse[$j][] = $xmlResponseArray['TOTALCHARGE'][$j];
|
311 |
+
$xmlResponse[$j][] = $xmlResponseArray['SERVICENAME'][$j];
|
312 |
+
$xmlResponse[$j][] = $xmlResponseArray['SERVICEDAYS'][$j];
|
313 |
+
$xmlResponse[$j][] = $xmlResponseArray['RATEID'][$j];
|
314 |
+
}
|
315 |
+
$response = '';
|
316 |
+
foreach($xmlResponse as $xmlResponse2){
|
317 |
+
|
318 |
+
$total_charge = $xmlResponse2[0];
|
319 |
+
$carriers_value = $xmlResponse2[1];
|
320 |
+
$business_day = $xmlResponse2[2];
|
321 |
+
$RATEID = $xmlResponse2[3];
|
322 |
+
if($total_charge == ''){}else {
|
323 |
+
if($carriers_value == NULL){
|
324 |
+
$response = "No Result Found, Please try another Carrier";
|
325 |
+
}else{
|
326 |
+
/* if($subtotal > $discount_amount){
|
327 |
+
if($total_charge < $discount_price){
|
328 |
+
} else{
|
329 |
+
$total_charge = $discount_price;
|
330 |
+
}
|
331 |
+
|
332 |
+
} */
|
333 |
+
/* if($markup == 'none'){
|
334 |
+
//$gettotal = $myPrice;
|
335 |
+
$total_charge;
|
336 |
+
}
|
337 |
+
|
338 |
+
if($markup == 'markup'){
|
339 |
+
if($markup_type == 'percent'){
|
340 |
+
$gettotal_pr = ($total_charge * $markup_price)/100;
|
341 |
+
$total_charge = $total_charge + $gettotal_pr;
|
342 |
+
|
343 |
+
}
|
344 |
+
else{
|
345 |
+
$total_charge = $total_charge + $markup_price ;
|
346 |
+
|
347 |
+
}
|
348 |
+
}
|
349 |
+
|
350 |
+
if($markup == 'discount'){
|
351 |
+
if($markup_type == 'percent'){
|
352 |
+
$gettotal_pr = ($total_charge * $markup_price)/100;
|
353 |
+
$total_charge = $total_charge - $gettotal_pr;
|
354 |
+
}
|
355 |
+
else{
|
356 |
+
$total_charge = $total_charge - $markup_price ;
|
357 |
+
}
|
358 |
+
} */
|
359 |
+
if($markup == 'none'){
|
360 |
+
$gettotal = $total_charge;
|
361 |
+
if($subtotal > $discount_amount){
|
362 |
+
//echo $total_charge;
|
363 |
+
if($gettotal < $discount_price){
|
364 |
+
}
|
365 |
+
else{
|
366 |
+
$gettotal = $discount_price;
|
367 |
+
}
|
368 |
+
}
|
369 |
+
|
370 |
+
}
|
371 |
+
|
372 |
+
if($markup == 'markup'){
|
373 |
+
$gettotal = $total_charge;
|
374 |
+
if($markup_type == 'percent'){
|
375 |
+
$markup_price = Mage::getStoreConfig('carriers/freightcenter/markup_price');
|
376 |
+
$gettotal_pr = ($gettotal * $markup_price)/100;
|
377 |
+
$gettotal = $gettotal + $gettotal_pr;
|
378 |
+
}
|
379 |
+
else{
|
380 |
+
//$markup_price = Mage::getStoreConfig('carriers/freightcenter/markup_price');
|
381 |
+
$gettotal = $gettotal + $markup_price ;
|
382 |
+
}
|
383 |
+
|
384 |
+
if($subtotal > $discount_amount){
|
385 |
+
//echo $total_charge;
|
386 |
+
if($gettotal < $discount_price){
|
387 |
+
}
|
388 |
+
else{
|
389 |
+
$gettotal = $discount_price;
|
390 |
+
}
|
391 |
+
}
|
392 |
+
}
|
393 |
+
|
394 |
+
if($markup == 'discount'){
|
395 |
+
$gettotal = $total_charge;
|
396 |
+
if($markup_type == 'percent'){
|
397 |
+
$markup_price = Mage::getStoreConfig('carriers/freightcenter/markup_price');
|
398 |
+
$gettotal_pr = ($gettotal * $markup_price)/100;
|
399 |
+
$gettotal = $gettotal - $gettotal_pr;
|
400 |
+
}
|
401 |
+
else{
|
402 |
+
//$markup_price = Mage::getStoreConfig('carriers/freightcenter/markup_price');
|
403 |
+
$gettotal = $gettotal - $markup_price ;
|
404 |
+
}
|
405 |
+
if($subtotal > $discount_amount){
|
406 |
+
//echo $total_charge;
|
407 |
+
if($gettotal < $discount_price){
|
408 |
+
}
|
409 |
+
else{
|
410 |
+
$gettotal = $discount_price;
|
411 |
+
}
|
412 |
+
}
|
413 |
+
|
414 |
+
|
415 |
+
|
416 |
+
}
|
417 |
+
|
418 |
+
if($gettotal < $total_charge){
|
419 |
+
$discount_get = $total_charge - $gettotal;
|
420 |
+
$discount_get = number_format($discount_get, 2, '.', ',');
|
421 |
+
$discount_ge = '</br>Discount:- <span>$'.$discount_get.'</span>';
|
422 |
+
$total_cha = number_format($total_charge, 2, '.', ',');
|
423 |
+
$total = ' </br>Cost: <span>$'.number_format($total_charge, 2, '.', ',').'</span>';
|
424 |
+
}else if ($gettotal < $total_charge){
|
425 |
+
$gettotal = $total_charge;
|
426 |
+
//$gettotal = number_format($gettotal, 2, '.', ',');
|
427 |
+
}
|
428 |
+
|
429 |
+
$response .= '<div style="display: block; margin-bottom: 20px; width: 100%;" class="ajax-result" id="ajax_result'.$proid.'">
|
430 |
+
|
431 |
+
<input type="radio" class="ajax" value="ajax_response" name="shipping'.$proid.'" onclick="ajaxcallnew('.$proid.','.$gettotal.','.$quote_id.','."'$carriers_value'".','."'$RATEID'".','."'$business_day'".');" id="ajax'.$proid.'" />
|
432 |
+
<label for="ajax'.$proid.'"><span style="font-weight:bold;">'.$carriers_value.'</span> <span style="display:none;" id="apply_rate'.$proid.'">
|
433 |
+
<img class="v-middle" title="Applying Carrier Rate..." alt="Applying Carrier Rate..." src="'.$loader.'" />
|
434 |
+
</span><br/>Estimated Transit Time: '.$business_day.' Business days</label>
|
435 |
+
'.$total.'
|
436 |
+
'.$discount_ge.'
|
437 |
+
</br>You Pay: <span>$'.number_format($gettotal, 2, '.', ',').'</span>
|
438 |
+
</div>';
|
439 |
+
|
440 |
+
}
|
441 |
+
}
|
442 |
+
|
443 |
+
}
|
444 |
+
}
|
445 |
+
|
446 |
+
$myresult[$proid] = $response;
|
447 |
+
}
|
448 |
+
$response = '';
|
449 |
+
//echo "<pre>";print_r($myresult);exit;
|
450 |
+
$gotresult['rates'] = $myresult;
|
451 |
+
echo json_encode($gotresult);
|
452 |
+
exit;
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>FreightCenter_Freight_Shipping</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>OSL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>FreightCenter Freight Shipping Extension</summary>
|
10 |
+
<description>Custom shipping module extension that pulls rates from the FreightCenter API and displays them for multiple warehouse shipments on the Magento front end. The rates can be later be booked via the FreightCenter API in the admin</description>
|
11 |
+
<notes>Stable Release</notes>
|
12 |
+
<authors><author><name>FreightCenter, Inc.</name><user>FreightCenter</user><email>marketing@freightcenter.com</email></author></authors>
|
13 |
+
<date>2014-11-04</date>
|
14 |
+
<time>12:48:51</time>
|
15 |
+
<contents><target name="magelocal"><dir name="Freightcenter"><dir name="CustomWare"><dir name="Block"><dir name="Adminhtml"><dir name="Collect"><dir name="Edit"><file name="Form.php" hash="1f5cd94d5876f73a376e461da5f19129"/></dir><file name="Edit.php" hash="821407aafded062336a8ca6c5b2b82f3"/><file name="Grid.php" hash="3901d4cef56c27a80c40e190b7ce3838"/></dir><file name="Collect.php" hash="68598d9fe865379005f7b9145907fe28"/></dir></dir><dir name="Helper"><file name="Data.php" hash="f0950fe007293dc58885895c7b6596d4"/></dir><dir name="Model"><file name="Collect.php" hash="d8bdf18cc842826056a6e19bb8af4783"/><dir name="Mysql4"><dir name="Collect"><file name="Collection.php" hash="7c6a70a92c38c7061101b662880aeee7"/></dir><file name="Collect.php" hash="aaa52bb7cd5f396ac64a484e556a478f"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="CollectController.php" hash="b485ebb0959e3f387879aafe579ac0d4"/><file name="CollectController.php@1Aug" hash="1e9d5c9d78e0ffbe1698d2ef807e620b"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="d022d665af8caffcba312be0ac62e629"/><file name="config.xml" hash="6c6a5204bbfc7fb2ed37e913c988c7cf"/></dir><dir name="sql"><dir name="freightcenter_customware_setup"><file name="mysql4-install-1.0.0.php" hash="c2a5df0325a856fa0cc2131a0fde094f"/></dir></dir></dir><dir name="Frieghtadmin"><dir name="Block"><dir name="Adminhtml"><dir name="Order"><dir name="View"><dir name="Tab"><file name="Frieghtadmin.php" hash="7292bcc896016b2b14216932a447aeb5"/></dir></dir></dir><dir name="Sales"><dir name="Order"><dir name="View"><file name="Frieghtadmin.php" hash="3d2ca460cf27264a4eb85dfd45a4d0ad"/><dir name="Tab"><file name="Frieghtadmin.php" hash="10defb482fa03ac45bfb65ec9dd915ca"/></dir></dir></dir></dir></dir></dir><dir name="etc"><file name="config.xml" hash="4c23d69b7142b164f759ccca44db387c"/></dir><dir name="sql"><dir name="freightcenters_freight_setup"><file name="mysql4-install-1.0.0.php" hash="0a8582eb8068d36325779339053e457a"/></dir></dir></dir><dir name="Ship"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="Cdisplay.php" hash="f41d7a1fe73c3f982449c7fb8ffd6151"/><file name="Destloctype.php" hash="ac35e3f4ca5989e58960d34ecf2ffb5d"/><file name="Positions.php" hash="fc9b75c01e6ab03e6e03d13cb3d4628a"/></dir></dir></dir><file name="Ship.php" hash="0ee698ddc3d4e09ab29d60f785264b05"/></dir><dir name="Helper"><file name="Data.php" hash="6c7b8a73ec7e06cb99392e578e464edb"/></dir><dir name="Model"><dir name="Carrier"><file name="Flatrate.php" hash="d76be5ff840af1dd15e2ad57ce4eba69"/><file name="Freightcenter.php" hash="8154c5064a7026622ffd614f851fd380"/></dir><file name="CarrierDisplay.php" hash="0da26481a773411082b897a6631d8e65"/><file name="Carriers.php" hash="6eeff436f6f22764c8beead2a8c76151"/><file name="Carriers_23rdMay.php" hash="15b7084fb9fa9c546f6a368b9b46ce2d"/><file name="Discount.php" hash="4d29371a6228b41ef4e3a3631a2c584e"/><file name="Flatrate.php__" hash="487d3ddfc60b6fa417df47588ad91725"/><file name="Loctypes.php" hash="497cffb6cd5fca57842dfc5cf37addca"/><file name="Mark.php" hash="f653d74c0fe72777f6ac3a436366f245"/><file name="Mode.php" hash="2bcd9a3b06831cd986f42d99f82d9ccf"/><file name="Sand.php" hash="68de8ef045fd1b1baff929b982ed9afc"/><file name="Types.php" hash="f838559834c2c0e4e66d337a97abf87d"/></dir><dir name="controllers"><file name="CartController.php" hash="d3fd5f35edfb1dac104ccb0012dbfb8a"/><file name="IndexController.php" hash="86ad8c2f64722f3b875feb7671b6f93b"/><dir name="System"><file name="ConfigController.php" hash="103017049b83a1094681b03ad85bc56b"/><file name="ConfigController.php@1Aug" hash="bab3110a9eafec3c16d1e29b47cf3901"/><file name="ConfigController.php@26June" hash="e336317fcd0d05a0e68cabdef921778f"/><file name="ConfigController_org23rdMay.php" hash="e38979f206d80b47b6cfdee0cde45ea0"/></dir></dir><dir name="etc"><file name="config.xml" hash="2bec8dfb6ead7e89b9d71f944f0a828c"/><file name="config.xml@new" hash="2157ee2ba41974d10c73255f332842c9"/><file name="config.xml@old" hash="8290865c69bcaae0285f8986d40a2dcc"/><file name="system.xml" hash="dcb7daafb59f19a309e18dd38b68acb8"/><file name="system.xml@18July" hash="3620f6d52fdfcbc9e7352bf005653b5d"/><file name="system.xml@1Aug" hash="ba8e6614e53efbb2712e3cd5a0de4654"/><file name="system.xml@24July" hash="c7f8f2e77f1c376ac390b5cce3fe46a4"/><file name="system.xml@30July" hash="8feb46afbf6fec8a9eadaf49e6b50b7b"/></dir></dir></dir><dir name="Freightcenters"><dir name="Freight"><dir name="controllers"><file name="CartController.php" hash="d3fd5f35edfb1dac104ccb0012dbfb8a"/><file name="IndexController.php" hash="bc80267f709d28987c5437772381f2d9"/><file name="IndexController.php@14Aug" hash="1694065a1c91d52057d0bcbf1402e66f"/><file name="IndexController.php@20June" hash="63609e2311afde441bdf5e3faabfe1f2"/><file name="IndexController_18thJune.php" hash="63609e2311afde441bdf5e3faabfe1f2"/></dir><dir name="etc"><file name="config.xml" hash="d44b60cea796763e7248af7f9cc072d5"/><file name="config.xml@23June" hash="f8f0053727821e619d0fc40a6b8c38ec"/></dir><dir name="sql"><dir name="freightcenters_freight_setup"><file name="mysql4-install-1.0.0.php" hash="9b2ff45cb11077b19d779e8ad01da298"/></dir></dir></dir></dir><dir name="Excellence"><dir name="Fee"><dir name="Block"><dir name="Sales"><dir name="Order"><file name="Total.php" hash="0bdae64ba133737cb8dcd57bb949e6ff"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="7378a57b43609117bc149afb7d32b339"/></dir><dir name="Model"><file name="Fee.php" hash="5f6297538c255c085e5367575e136ce2"/><file name="Observer.php" hash="808c88b893e7bb41051c27311d1140c8"/><dir name="Sales"><dir name="Order"><dir name="Total"><dir name="Creditmemo"><file name="Fee.php" hash="4a0fd96c8d32644a5229e4bb8121b6cd"/></dir><dir name="Invoice"><file name="Fee.php" hash="7de8f9faf794c64852eb742e0dbfcb27"/></dir></dir></dir><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Fee.php" hash="838b4c38dd6b89ab20fa0cc8e7a7e81f"/></dir></dir></dir></dir></dir><dir name="etc"><file name="config.xml" hash="62763cfc06c5529fa7b3ad128257c167"/></dir><dir name="sql"><dir name="fee_setup"><file name="mysql4-install-0.1.0.php" hash="f508931a7a4eed80560bb87889fc9b59"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="683617f1cf9d393ccd6459aa0976c6af"/><file name="mysql4-upgrade-0.1.1-0.1.2.php" hash="e3904443f5aa3d891ff66c1085d87ce9"/><file name="mysql4-upgrade-0.1.2-0.1.3.php" hash="ab135913c99bd5afd1d8d37eb192c33a"/><file name="mysql4-upgrade-0.1.3-0.1.4.php" hash="e024f48acdc691c388f409c5bc33eed3"/></dir></dir></dir></dir><dir name="Mage"><dir name="Shipping"><dir name="Block"><dir name="Tracking"><file name="Ajax.php" hash="7686ab1d93520de9ebcaff5cda30791c"/><file name="Popup.php" hash="1e9babea1817ec28faa24657fb5d2f30"/></dir></dir><file name="Exception.php" hash="882248ea959efbf84a8996902772c645"/><dir name="Helper"><file name="Data.php" hash="9953784509cb1a9e62ef4103585a5847"/></dir><dir name="Model"><dir name="Carrier"><file name="Abstract.php" hash="5be2be60a5722a298d7dd17b6546e287"/><file name="Flatrate.php" hash="0afd66e29241f790a93ac85a70f1d8d0"/><file name="Flatrate_org21stJune.php" hash="4b431236510b4c72c5d7e7a4c34d3afb"/><file name="Freeshipping.php" hash="b4b77452ce4fd8c6174db2a3653e93a2"/><file name="Interface.php" hash="5fddefab850ca206ab6476c3868ea4f2"/><file name="Pickup.php" hash="42feda041aea6740362ba0e586a8c302"/><file name="Tablerate.php" hash="b72fa439096e2764c6d39941f94628df"/></dir><file name="Config.php" hash="5a5ed8afb5173825c8aa4f011a0392b1"/><file name="Info.php" hash="f44e7d42de59aeb4a194007b88df934e"/><dir name="Mysql4"><dir name="Carrier"><dir name="Tablerate"><file name="Collection.php" hash="70b33de2b6e2e03c539377bba090e82c"/></dir><file name="Tablerate.php" hash="c3e01a959796939cc7dac5eabb09c50e"/></dir></dir><dir name="Rate"><file name="Abstract.php" hash="63f7997d6298ebf86bcd917ade4d1f05"/><file name="Request.php" hash="450b67408f83d366154fd8085efb065a"/><dir name="Result"><file name="Abstract.php" hash="cd0ac38285c399ed9b57ae3644e3dd61"/><file name="Error.php" hash="cc1eff5ec956a04ba58c075e6f17cd55"/><file name="Method.php" hash="15f368a4d9da153b19d5e44395643f4e"/></dir><file name="Result.php" hash="493c2d3668e061211725cc4c1e33ea4d"/></dir><dir name="Resource"><dir name="Carrier"><dir name="Tablerate"><file name="Collection.php" hash="61ddddf6df1f42c359873f9d89204f7a"/></dir><file name="Tablerate.php" hash="ac12086fb986977fc9ddd1837de6ec7e"/></dir></dir><dir name="Shipment"><file name="Request.php" hash="d5391620172a22ed066af8181b4aa41d"/><file name="Return.php" hash="a29c9504d833cc119cdfdf7a12eb8e0e"/></dir><file name="Shipping.php" hash="2422229e12ac153e6eeea005dbd7e4d9"/><dir name="Source"><file name="HandlingAction.php" hash="71ae2035678e31890e4e4d0f3fd3a8d2"/><file name="HandlingType.php" hash="c30d5ff2c2be67b64d718fd27d6080dd"/></dir><dir name="Tracking"><dir name="Result"><file name="Abstract.php" hash="e0e0791dddac62fdf1539ee45cbaa8be"/><file name="Error.php" hash="eb5005dd4a6568cb7d598223dde7c9a0"/><file name="Status.php" hash="405a1d9a445dfdafa225dfeb1d9a4b75"/></dir><file name="Result.php" hash="dbd9ba830967809f7af471409e2e33df"/></dir></dir><dir name="controllers"><file name="ShippingController.php" hash="949df82f1838565f8a1fb8af951397aa"/><file name="TrackingController.php" hash="b6e0d0be429af3d5b787d3aafabfb14b"/></dir><dir name="etc"><file name="adminhtml.xml" hash="db2375486ac500b756e59752ec256980"/><file name="config.xml" hash="0050f0736ab73f63b64a196a4d7c183f"/><file name="system.xml" hash="948f18c4e2f472f185becf448912ea8a"/></dir><dir name="sql"><dir name="shipping_setup"><file name="install-1.6.0.0.php" hash="28185965bfedc83ef2bf66857f64f31a"/><file name="mysql4-install-0.7.0.php" hash="a631f8b5a43af90b847cc123319b4d32"/><file name="mysql4-upgrade-1.5.9.9-1.6.0.0.php" hash="66f67b304d3174f075886bbb432758cd"/></dir></dir></dir></dir></target><target name="mageweb"><dir name="."><file name="api_cancel.php" hash="7a7fec5a11b0e547ad754021791495aa"/><file name="api_check.php" hash="23d05af0b8adda7d2554c21ac11b6d72"/><file name="api_check_new.php" hash="88d93c0a286eab80594e4eb4f79b2ced"/><file name="BOLCheck.php" hash="a124c4a522603481c1fa393d0f288951"/><file name="loctype_api.php" hash="dbd3a9d97746075c56159d4bf6816c5c"/><file name="loctype_api_one.php" hash="3a1e4179362f7d201fb46973348ea4c6"/><file name="RemoveFreight.php" hash="df3df7b3861ee939abf22b5ed5aac81e"/></dir></target><target name="mageetc"><dir name="modules"><file name="Excellence_Fee.xml" hash="f1607b7ccb6d3dfd97e0c6a72cb04404"/><file name="Freightcenter_CustomWare.xml" hash="fffbefcb3f923b0987a8b9b4dd78c850"/><file name="Freightcenter_Ship.xml" hash="1b584f7abcee8ac8ba138e28bbcc927b"/><file name="Freightcenters_Freight.xml" hash="9abe2712cbec32f5cc4964e63bde8ce5"/><file name="Freightcenter_Frieghtadmin.xml" hash="d3cd0f9f9b1d0de731b7651ffaf7e262"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="fee.xml" hash="96955d111e2a9014d5dc3d18201ddddf"/><file name="freightcenter_frieghtadmin.xml" hash="a9f0bf1f7d2449cc33ed9724b305c1fb"/><file name="frieghtadmin.xml" hash="2f993ba231d0576728ab222743c90dd1"/><dir name="freightcenter"><file name="customware.xml" hash="f278cb4c03c833b2c8f93eefbf2d5456"/></dir></dir><dir name="template"><dir name="fee"><dir name="sales"><dir name="order"><file name="refunded.phtml" hash="f4239d313366d75907a34b3342b35eb1"/><file name="total.phtml" hash="bbb080fb20415086d72719c1f1f613d4"/></dir></dir></dir><dir name="freightcenter"><dir name="frieghtadmin"><dir name="order"><dir name="view"><dir name="tab"><file name="frieghtadmin.phtml" hash="59b2e3ffdf1d63fcd678cb3a3285f4ab"/></dir></dir></dir></dir></dir><dir name="freightcenter_ship"><dir name="system"><dir name="config"><file name="cdisplay.phtml" hash="eee8123c7dd0d256d17b0c38bb5a2eb3"/><file name="destloctype.phtml" hash="6269924aff886a841c9cba4b42b59ea1"/><file name="positions.phtml" hash="5cc5cd8b04ad69100566145ab126a2a5"/></dir></dir></dir><dir name="sales"><dir name="order"><dir name="view"><file name="items.phtml" hash="911226e17a6bd828a5b11ca98c4fd5d8"/><dir name="items"><dir name="renderer"><file name="default.phtml" hash="80641bae96d4bb9082c470d4bc123ca4"/></dir></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="fee.xml" hash="97d67fc83755f625dfe305748fca65b1"/></dir><dir name="template"><dir name="checkout"><dir name="cart"><file name="shipping.phtml" hash="4baf50212ac6c291cd8acb495fb7b8c6"/></dir><dir name="onepage"><dir name="payment"><file name="info.phtml" hash="e3d23f5d3e0b135ca38ec7ab5b41f851"/><file name="methods.phtml" hash="b88d2e4a2f375b5fb4a3983539b2e81e"/></dir><dir name="progress"><file name="billing.phtml" hash="e0c20674a6831364b055424dac493acb"/><file name="payment.phtml" hash="2c5af1d7ea230faa3963781f85e9f610"/><file name="shipping.phtml" hash="b26f2b46e5c12cda8de4ecb37f98c355"/><file name="shipping_method.phtml" hash="59e5c45f7f5c023b97aa6b3b2042ba17"/></dir><dir name="review"><file name="button.phtml" hash="d7a54917e7d0ceec6875760a3910452f"/><file name="info.phtml" hash="d6faa974823cb6a1c4e423262e14c72c"/><file name="item.phtml" hash="012d4b6887dd25ff362156b69fc8f825"/><file name="totals.phtml" hash="0acb66397e2d390de49dbdfca15d9804"/></dir><dir name="shipping_method"><file name="additional.phtml" hash="7f8751c51089c14316694e2aa6c5357d"/><file name="available.phtml" hash="78e087c719447383fd2560bbd9b6dff7"/></dir><file name="agreements.phtml" hash="a8f762dd61914b2d9eab9fe9ada1945a"/><file name="billing.phtml" hash="493ea449ce0655dc3aaee8986c7f0ba5"/><file name="failure.phtml" hash="0b95128399f2521bf12837aceaa31836"/><file name="link.phtml" hash="323dcf7f1acb91a186595b618592be86"/><file name="login.phtml" hash="923c114caf3bcaeea2adc266faa7de23"/><file name="payment.phtml" hash="0f2094bb3da954aa9405c1af7b66ae2a"/><file name="progress.phtml" hash="3eab47ed120f6efd05f85294da825544"/><file name="review.phtml" hash="5ffdd3cc23815519462e3dcb1fc6b81a"/><file name="shipping.phtml" hash="ddec0377a5672289f6df2cce615afe12"/><file name="shipping_method.phtml" hash="51e5d90335a974a0d4c0a2af9364ceca"/></dir></dir><dir name="fee"><file name="fee.phtml" hash="d1ae3b16e9473cf366d6338e158295e6"/></dir><dir name="page"><dir name="html"><file name="head.phtml" hash="cb61183d8aa8ad92a965fe2bff4ecb0b"/></dir></dir><dir name="sales"><dir name="order"><file name="info.phtml" hash="599564a467e899a75b39f30b0188be07"/><file name="print.phtml" hash="d92d718ccebb09dd9d8b2877563d7506"/></dir></dir><dir name="tax"><dir name="checkout"><file name="discount.phtml" hash="c3232e4e0e91d1e3d58fd5ccb0286d15"/><file name="grandtotal.phtml" hash="e5335ffe8c8020e39a0fbde4b076fbfb"/><file name="shipping.phtml" hash="7213e1850d846c0261ac48a8c6c7fc7e"/><file name="subtotal.phtml" hash="538f9fc386a8979136c2f8dc90412de2"/><file name="tax.phtml" hash="b2e0cbdd1eee49d85e507f52d372e67c"/></dir><dir name="order"><file name="tax.phtml" hash="c551e5681ccc3d95d37640f91431362d"/></dir></dir></dir></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.0.0</min><max>5.6.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.7</min><max>1.8.0.1</max></package></required></dependencies>
|
18 |
+
</package>
|