Version Notes
This is stable version of this extension and has been tested on various version of community editions.
In this particular version we are supporting it to run on PHP V 5.5.X
Download this release
Release Info
Developer | Rave Infosys |
Extension | Raveinfosys_Freightshipping |
Version | 0.1.0 |
Comparing to | |
See all releases |
Version 0.1.0
- app/code/local/Raveinfosys/Freightshipping/Block/Checkout/Cart/Shipping.php +42 -0
- app/code/local/Raveinfosys/Freightshipping/Block/Onepage/Shipping/Method/Available.php +18 -0
- app/code/local/Raveinfosys/Freightshipping/Helper/Data.php +38 -0
- app/code/local/Raveinfosys/Freightshipping/Model/Carrier/Abstract.php +168 -0
- app/code/local/Raveinfosys/Freightshipping/Model/Carrier/Bestquote.php +46 -0
- app/code/local/Raveinfosys/Freightshipping/Model/Carrier/Conway.php +168 -0
- app/code/local/Raveinfosys/Freightshipping/Model/Carrier/Rlcarriers.php +175 -0
- app/code/local/Raveinfosys/Freightshipping/Model/Observer.php +34 -0
- app/code/local/Raveinfosys/Freightshipping/Model/Source/Conway/Country.php +12 -0
- app/code/local/Raveinfosys/Freightshipping/Model/Source/Conway/Shipcode.php +13 -0
- app/code/local/Raveinfosys/Freightshipping/Model/Source/Destinationtype.php +11 -0
- app/code/local/Raveinfosys/Freightshipping/Model/Source/Rlcarriers/Country.php +12 -0
- app/code/local/Raveinfosys/Freightshipping/Model/Source/Rlcarriers/Method.php +14 -0
- app/code/local/Raveinfosys/Freightshipping/Model/Source/Shipclass.php +22 -0
- app/code/local/Raveinfosys/Freightshipping/etc/adminhtml.xml +23 -0
- app/code/local/Raveinfosys/Freightshipping/etc/config.xml +84 -0
- app/code/local/Raveinfosys/Freightshipping/etc/system.xml +392 -0
- app/code/local/Raveinfosys/Freightshipping/sql/freightshipping_setup/mysql4-install-0.0.1.php +42 -0
- app/etc/modules/Raveinfosys_Freightshipping.xml +13 -0
- package.xml +19 -0
app/code/local/Raveinfosys/Freightshipping/Block/Checkout/Cart/Shipping.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Checkout
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
class Raveinfosys_Freightshipping_Block_Checkout_Cart_Shipping extends Mage_Checkout_Block_Cart_Shipping
|
29 |
+
{
|
30 |
+
public function getCarrierName($carrierCode)
|
31 |
+
{
|
32 |
+
$_helper = Mage::helper('freightshipping');
|
33 |
+
$_carriers = $_helper->getAvailableCarriers();
|
34 |
+
if(in_array($carrierCode, $_carriers) && $name = Mage::getStoreConfig('freightshipping/'.$carrierCode.'/title')){
|
35 |
+
return $name;
|
36 |
+
}
|
37 |
+
if ($name = Mage::getStoreConfig('carriers/'.$carrierCode.'/title')) {
|
38 |
+
return $name;
|
39 |
+
}
|
40 |
+
return $carrierCode;
|
41 |
+
}
|
42 |
+
}
|
app/code/local/Raveinfosys/Freightshipping/Block/Onepage/Shipping/Method/Available.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Raveinfosys_Freightshipping_Block_Onepage_Shipping_Method_Available
|
3 |
+
extends Mage_Checkout_Block_Onepage_Shipping_Method_Available
|
4 |
+
{
|
5 |
+
public function getCarrierName($carrierCode)
|
6 |
+
{
|
7 |
+
$_helper = Mage::helper('freightshipping');
|
8 |
+
$_carriers = $_helper->getAvailableCarriers();
|
9 |
+
if(in_array($carrierCode, $_carriers) && $name = Mage::getStoreConfig('freightshipping/'.$carrierCode.'/title')){
|
10 |
+
return $name;
|
11 |
+
}
|
12 |
+
if ($name = Mage::getStoreConfig('carriers/'.$carrierCode.'/title')) {
|
13 |
+
return $name;
|
14 |
+
}
|
15 |
+
return $carrierCode;
|
16 |
+
}
|
17 |
+
|
18 |
+
}
|
app/code/local/Raveinfosys/Freightshipping/Helper/Data.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Raveinfosys_Freightshipping_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Check is module exists and enabled in global config.
|
7 |
+
* @param $moduleName
|
8 |
+
*/
|
9 |
+
|
10 |
+
public function isModuleEnabled($moduleName = null)
|
11 |
+
{
|
12 |
+
|
13 |
+
if ($moduleName === null) {
|
14 |
+
return false;
|
15 |
+
}
|
16 |
+
|
17 |
+
if (!Mage::getConfig()->getNode('modules/' . $moduleName)) {
|
18 |
+
return false;
|
19 |
+
}
|
20 |
+
|
21 |
+
return true;
|
22 |
+
}
|
23 |
+
|
24 |
+
public function getAvailableCarriers()
|
25 |
+
{
|
26 |
+
$_availableCarriers = array();
|
27 |
+
$configFile = Mage::getConfig()->getModuleDir('etc', 'Raveinfosys_Freightshipping').DS.'config.xml';
|
28 |
+
$string = file_get_contents($configFile);
|
29 |
+
$xml = simplexml_load_string($string, 'Varien_Simplexml_Element');
|
30 |
+
$_carriers = json_decode(json_encode($xml), true);
|
31 |
+
foreach($_carriers['default']['carriers'] as $key => $carrier){
|
32 |
+
$_availableCarriers[] = $key;
|
33 |
+
}
|
34 |
+
return $_availableCarriers;
|
35 |
+
}
|
36 |
+
|
37 |
+
}
|
38 |
+
|
app/code/local/Raveinfosys/Freightshipping/Model/Carrier/Abstract.php
ADDED
@@ -0,0 +1,168 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
abstract class Raveinfosys_Freightshipping_Model_Carrier_Abstract
|
4 |
+
extends Mage_Shipping_Model_Carrier_Abstract
|
5 |
+
implements Mage_Shipping_Model_Carrier_Interface
|
6 |
+
{
|
7 |
+
protected $_code = '';
|
8 |
+
|
9 |
+
protected $_result = null;
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Fields that should be replaced in debug with '***'
|
13 |
+
*
|
14 |
+
* @var array
|
15 |
+
*/
|
16 |
+
public $_debugReplacePrivateDataKeys = array();
|
17 |
+
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Collect rates for this shipping method based on information in $request
|
21 |
+
*
|
22 |
+
* @param Mage_Shipping_Model_Rate_Request $data
|
23 |
+
* @return Mage_Shipping_Model_Rate_Result
|
24 |
+
*/
|
25 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
26 |
+
{
|
27 |
+
if($this->getConfigValue('active') && $this->_code != 'bestquote'){
|
28 |
+
return false;
|
29 |
+
}
|
30 |
+
|
31 |
+
if(!$this->checkAllowedShipCountries($request->getDestCountryId())
|
32 |
+
|| !$this->isPackageWeightAllowed($request->getPackageWeight())) {
|
33 |
+
return false;
|
34 |
+
}
|
35 |
+
|
36 |
+
$this->_result = $this->getRates($request);
|
37 |
+
|
38 |
+
return $this->getResult();
|
39 |
+
}
|
40 |
+
|
41 |
+
public function getResult()
|
42 |
+
{
|
43 |
+
if($this->_result){
|
44 |
+
$result = Mage::getModel('shipping/rate_result');
|
45 |
+
foreach($this->_result as $_method) {
|
46 |
+
$method = Mage::getModel('shipping/rate_result_method');
|
47 |
+
$method->setCarrier($_method['carrier']);
|
48 |
+
$method->setCarrierTitle($_method['carrier']);
|
49 |
+
$method->setMethod($_method['code']);
|
50 |
+
$method->setMethodTitle($_method['method']);
|
51 |
+
$method->setPrice($_method['rates']);
|
52 |
+
$method->setCost($_method['rates']);
|
53 |
+
$result->append($method);
|
54 |
+
}
|
55 |
+
} elseif($this->_result === false) {
|
56 |
+
$error = Mage::getModel('shipping/rate_result_error');
|
57 |
+
$error->setCarrier($this->_code);
|
58 |
+
$error->setCarrierTitle(Mage::getStoreConfig($this->_configPath.'/title'));
|
59 |
+
$errorMsg = Mage::getStoreConfig($this->_configPath.'/errormessage');
|
60 |
+
$error->setErrorMessage($errorMsg ? $errorMsg : Mage::helper('shipping')->__('This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.'));
|
61 |
+
return $error;
|
62 |
+
} else {
|
63 |
+
return false;
|
64 |
+
}
|
65 |
+
return $result;
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Get allowed shipping methods
|
70 |
+
*
|
71 |
+
* @return array
|
72 |
+
*/
|
73 |
+
public function getAllowedMethods()
|
74 |
+
{
|
75 |
+
if($_allowdMethods = $this->getConfigValue('allowed_methods', $this->_code)){
|
76 |
+
$_methods = explode(',', $_allowdMethods);
|
77 |
+
foreach($_methods as $_method){
|
78 |
+
$_methodArray[$_method] = $_method;
|
79 |
+
}
|
80 |
+
return $_methodArray;
|
81 |
+
} else {
|
82 |
+
return array($this->_code => $this->getConfigValue('title', $this->_code));
|
83 |
+
}
|
84 |
+
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Get Available shipping rates
|
89 |
+
*
|
90 |
+
* @return array
|
91 |
+
*/
|
92 |
+
public function getRates(Mage_Shipping_Model_Rate_Request $request)
|
93 |
+
{
|
94 |
+
return $this->_result;
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Retrieve information from carrier configuration
|
99 |
+
*
|
100 |
+
* @return mixed
|
101 |
+
*/
|
102 |
+
public function getConfigValue($_field = null, $_groupCode = null)
|
103 |
+
{
|
104 |
+
if(!$_field){
|
105 |
+
return '';
|
106 |
+
}
|
107 |
+
if($_groupCode){
|
108 |
+
return Mage::getStoreConfig('freightshipping/'.$_groupCode.'/'.$_field, $this->getStore());
|
109 |
+
} else {
|
110 |
+
return Mage::getStoreConfig('freightshipping/general/'.$_field, $this->getStore());
|
111 |
+
}
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Log debug data to file
|
116 |
+
*
|
117 |
+
* @param mixed $debugData
|
118 |
+
*/
|
119 |
+
public function debugData($debugData)
|
120 |
+
{
|
121 |
+
if($this->getConfigValue('debug', $this->_code)) {
|
122 |
+
Mage::getModel('core/log_adapter', 'shipping_' . $this->_code . '.log')
|
123 |
+
->setFilterDataKeys($this->_debugReplacePrivateDataKeys)
|
124 |
+
->log($debugData);
|
125 |
+
}
|
126 |
+
}
|
127 |
+
|
128 |
+
public function calculateHandlingFee($_rates)
|
129 |
+
{
|
130 |
+
if($this->getConfigValue('handlingfee_type', $this->_code) == 'F') {
|
131 |
+
$_rates = $_rates + $this->getConfigValue('handlingfee', $this->_code);
|
132 |
+
} elseif($this->getConfigValue('handlingfee_type', $this->_code) == 'P') {
|
133 |
+
$_rates = $_rates + ($_rates*$_handlingFee/100);
|
134 |
+
}
|
135 |
+
return $_rates;
|
136 |
+
}
|
137 |
+
|
138 |
+
public function checkAllowedShipCountries($_countryId)
|
139 |
+
{
|
140 |
+
$speCountriesAllow = $this->getConfigValue('sallowspecific', $this->_code);
|
141 |
+
$_speCountriesFlag = false;
|
142 |
+
if($speCountriesAllow && $speCountriesAllow == 1){
|
143 |
+
$availableCountries = array();
|
144 |
+
if($this->getConfigValue('specificcountry', $this->_code)) {
|
145 |
+
$availableCountries = explode(',',$this->getConfigValue('specificcountry', $this->_code));
|
146 |
+
}
|
147 |
+
if($availableCountries && in_array($_countryId, $availableCountries)) {
|
148 |
+
$_speCountriesFlag = true;
|
149 |
+
}
|
150 |
+
} else {
|
151 |
+
if($_countryId == 'US' || $_countryId == 'CA')
|
152 |
+
{
|
153 |
+
$_speCountriesFlag = true;
|
154 |
+
}
|
155 |
+
}
|
156 |
+
return $_speCountriesFlag;
|
157 |
+
}
|
158 |
+
|
159 |
+
public function isPackageWeightAllowed($_packageWeight){
|
160 |
+
$_minWeight = $this->getConfigValue('min_weight',$this->_code);
|
161 |
+
$_maxWeight = $this->getConfigValue('max_weight',$this->_code);
|
162 |
+
if($_minWeight && ($_packageWeight < $_minWeight) || $_maxWeight && ($_packageWeight > $_maxWeight)){
|
163 |
+
return false;
|
164 |
+
}
|
165 |
+
return true;
|
166 |
+
|
167 |
+
}
|
168 |
+
}
|
app/code/local/Raveinfosys/Freightshipping/Model/Carrier/Bestquote.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Raveinfosys_Freightshipping_Model_Carrier_Bestquote extends Raveinfosys_Freightshipping_Model_Carrier_Abstract
|
3 |
+
{
|
4 |
+
public $_code = 'bestquote';
|
5 |
+
|
6 |
+
public function getRates(Mage_Shipping_Model_Rate_Request $request)
|
7 |
+
{
|
8 |
+
if(!$this->getConfigValue('active')){
|
9 |
+
return;
|
10 |
+
}
|
11 |
+
$_carriers = $this->getAvailableCarriers();
|
12 |
+
$_cheapestRate = 0;
|
13 |
+
foreach($_carriers as $_carrier){
|
14 |
+
$model = Mage::getModel($_carrier);
|
15 |
+
$_rates = $model->getRates($request);
|
16 |
+
if($_rates){
|
17 |
+
foreach($_rates as $_rate){
|
18 |
+
if($_cheapestRate == 0 || $_cheapestRate[0]['rates'] > $_rate['rates'] ){
|
19 |
+
$_cheapestRate = array($_rate);
|
20 |
+
}
|
21 |
+
}
|
22 |
+
}
|
23 |
+
}
|
24 |
+
return $_cheapestRate;
|
25 |
+
}
|
26 |
+
|
27 |
+
|
28 |
+
protected function getAvailableCarriers()
|
29 |
+
{
|
30 |
+
$_availableCarriers = array();
|
31 |
+
$configFile = Mage::getConfig()->getModuleDir('etc', 'Raveinfosys_Freightshipping').DS.'config.xml';
|
32 |
+
$string = file_get_contents($configFile);
|
33 |
+
$xml = simplexml_load_string($string, 'Varien_Simplexml_Element');
|
34 |
+
$_carriers = json_decode(json_encode($xml), true);
|
35 |
+
foreach($_carriers['default']['carriers'] as $key => $carrier){
|
36 |
+
if($key != $this->_code){
|
37 |
+
$_availableCarriers[$key] = $carrier['model'];
|
38 |
+
}
|
39 |
+
}
|
40 |
+
return $_availableCarriers;
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
+
|
45 |
+
|
46 |
+
?>
|
app/code/local/Raveinfosys/Freightshipping/Model/Carrier/Conway.php
ADDED
@@ -0,0 +1,168 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Raveinfosys_Freightshipping_Model_Carrier_Conway extends Raveinfosys_Freightshipping_Model_Carrier_Abstract
|
3 |
+
{
|
4 |
+
/* Shipping Carrier Code */
|
5 |
+
public $_code = 'conway';
|
6 |
+
|
7 |
+
/* Con-way test user credentials */
|
8 |
+
protected $_username = 'demo';
|
9 |
+
protected $_password = 'demo';
|
10 |
+
|
11 |
+
/* Con-way customer number & Ship code, to get customer specific discount */
|
12 |
+
protected $_custNmbr = null;
|
13 |
+
protected $_shipCode = null;
|
14 |
+
|
15 |
+
/* Con-way request quote URL */
|
16 |
+
protected $_requestUrl = 'https://www.con-way.com/XMLj/X-Rate';
|
17 |
+
|
18 |
+
public function isTrackingAvailable()
|
19 |
+
{
|
20 |
+
return true;
|
21 |
+
}
|
22 |
+
|
23 |
+
public function getTrackingInfo($tracking)
|
24 |
+
{
|
25 |
+
$track = Mage::getModel('shipping/tracking_result_status');
|
26 |
+
$track->setUrl('http://www.con-way.com/webapp/manifestrpts_p_app/Tracking/Tracking.jsp')
|
27 |
+
->setTracking($tracking)
|
28 |
+
->setCarrierTitle($this->getConfigValue('title', $this->_code));
|
29 |
+
return $track;
|
30 |
+
}
|
31 |
+
|
32 |
+
public function setConwayData()
|
33 |
+
{
|
34 |
+
$this->_username = Mage::helper('core')->decrypt($this->getConfigValue('userid', $this->_code));
|
35 |
+
$this->_password = Mage::helper('core')->decrypt($this->getConfigValue('password', $this->_code));
|
36 |
+
$this->_custNmbr = $this->getConfigValue('customerno', $this->_code);
|
37 |
+
$this->_shipCode = $this->getConfigValue('shipcode', $this->_code);
|
38 |
+
}
|
39 |
+
|
40 |
+
public function getRates(Mage_Shipping_Model_Rate_Request $request)
|
41 |
+
{
|
42 |
+
if(!$this->getConfigValue('active', $this->_code)){
|
43 |
+
return;
|
44 |
+
}
|
45 |
+
|
46 |
+
/******Set defualt module config data*******/
|
47 |
+
if(!($_originZip = $this->getConfigValue('origin'))){
|
48 |
+
$_originZip = Mage::getStoreConfig('shipping/origin/postcode');
|
49 |
+
}
|
50 |
+
$_defaultShipClass = $this->getConfigValue('shipclass');
|
51 |
+
|
52 |
+
$_debugData = array();
|
53 |
+
$this->setConwayData();
|
54 |
+
$accArray = array();
|
55 |
+
$xmlRequest = "<RateRequest>" .
|
56 |
+
"<OriginZip country=\"us\">".$_originZip."</OriginZip>".
|
57 |
+
"<DestinationZip country=\"us\">".$request->getDestPostcode()."</DestinationZip>";
|
58 |
+
|
59 |
+
if($this->_custNmbr){
|
60 |
+
$xmlRequest .= "<CustNmbr shipcode=\"".$this->_shipCode."\">".$this->_custNmbr."</CustNmbr>";
|
61 |
+
}
|
62 |
+
|
63 |
+
/* $xmlRequest .= "<ChargeCode>P</ChargeCode>
|
64 |
+
<EffectiveDate>$_effectedDate</EffectiveDate>"; */
|
65 |
+
|
66 |
+
if($request->getAllItems()) {
|
67 |
+
foreach($request->getAllItems() as $_item){
|
68 |
+
|
69 |
+
if ($_item->getProduct()->isVirtual() || $_item->getParentItem()) {
|
70 |
+
continue;
|
71 |
+
}
|
72 |
+
|
73 |
+
if($_item->getHasChildren()){
|
74 |
+
foreach ($_item->getChildren() as $child){
|
75 |
+
if($child->getProduct()->isVirtual()){
|
76 |
+
continue;
|
77 |
+
}
|
78 |
+
$_product = Mage::getModel('catalog/product')->load($child->getProductId());
|
79 |
+
$_productWeight = ceil($_product->getWeight()*$_item->getQty());
|
80 |
+
$_productFreightClass = $_product->getFreightClass() ? $_product->getFreightClass() : $_defaultShipClass;
|
81 |
+
$xmlRequest .= "<Item>" .
|
82 |
+
"<CmdtyClass>".$_productFreightClass."</CmdtyClass>" .
|
83 |
+
"<Weight unit='lbs'>".$_productWeight."</Weight>" .
|
84 |
+
"</Item>";
|
85 |
+
}
|
86 |
+
} else {
|
87 |
+
$_product = Mage::getModel('catalog/product')->load($_item->getProductId());
|
88 |
+
$_productWeight = ceil($_item->getProduct()->getWeight()*$_item->getQty());
|
89 |
+
$_productFreightClass = $_product->getFreightClass() ? $_product->getFreightClass() : $_defaultShipClass;
|
90 |
+
$xmlRequest .= "<Item>" .
|
91 |
+
"<CmdtyClass>".$_productFreightClass."</CmdtyClass>" .
|
92 |
+
"<Weight unit='lbs'>".$_productWeight."</Weight>" .
|
93 |
+
"</Item>";
|
94 |
+
}
|
95 |
+
|
96 |
+
}
|
97 |
+
}
|
98 |
+
$accArray = $this->getAccessorialServices();
|
99 |
+
|
100 |
+
if(count($accArray) > 0){
|
101 |
+
foreach ($accArray as $acc) {
|
102 |
+
$xmlRequest .= "<Accessorial>$acc</Accessorial>";
|
103 |
+
}
|
104 |
+
}
|
105 |
+
$_debugData['request'] = $xmlRequest;
|
106 |
+
$xmlRequest .= "</RateRequest>";
|
107 |
+
|
108 |
+
try {
|
109 |
+
$xmlRequest = urlencode($xmlRequest);
|
110 |
+
$urlConn = curl_init($this->_requestUrl);
|
111 |
+
curl_setopt ($urlConn, CURLOPT_POST, 1);
|
112 |
+
curl_setopt ($urlConn, CURLOPT_SSL_VERIFYPEER, false);
|
113 |
+
curl_setopt ($urlConn, CURLOPT_HTTPHEADER, array("Content-type: application/x-www-form-urlencoded"));
|
114 |
+
curl_setopt ($urlConn, CURLOPT_USERPWD, $this->_username.":".$this->_password);
|
115 |
+
curl_setopt ($urlConn, CURLOPT_POSTFIELDS, "RateRequest=$xmlRequest");
|
116 |
+
ob_start();
|
117 |
+
curl_exec($urlConn);
|
118 |
+
$xmlResponse = simplexml_load_string( ob_get_contents() );
|
119 |
+
ob_end_clean();
|
120 |
+
curl_close($urlConn);
|
121 |
+
} catch (Exception $e) {
|
122 |
+
return false;
|
123 |
+
}
|
124 |
+
$_debugData['result'] = $xmlResponse;
|
125 |
+
if($xmlResponse->xpath('//'.'Error')){
|
126 |
+
$this->debugData($_debugData);
|
127 |
+
return false;
|
128 |
+
}
|
129 |
+
$_results = $this->parseXmlResponse($xmlResponse);
|
130 |
+
$_debugData['result'] = $_results;
|
131 |
+
$this->debugData($_debugData);
|
132 |
+
return $_results;
|
133 |
+
}
|
134 |
+
|
135 |
+
protected function parseXmlResponse($xmlResponse){
|
136 |
+
$_rates = array();
|
137 |
+
$myElements = array('NetCharge');
|
138 |
+
for ($i=0; $i < count($xmlResponse->xpath('//'.$myElements[0])); $i++) {
|
139 |
+
foreach ($myElements as $myEl) {
|
140 |
+
$myVals = $xmlResponse->xpath('//'.$myEl);
|
141 |
+
$response[$myEl] = $myVals[$i];
|
142 |
+
}
|
143 |
+
}
|
144 |
+
$_rates[] = array('rates' => (float)preg_replace('/[^0-9.]*/', '', $response['NetCharge']), 'carrier' => $this->_code, 'method' => 'Conway', 'code' => $this->_code);
|
145 |
+
return $_rates;
|
146 |
+
}
|
147 |
+
|
148 |
+
protected function getAccessorialServices(){
|
149 |
+
$accArray = array();
|
150 |
+
if($this->getConfigValue('dest_type') == 'RES'){
|
151 |
+
$accArray[] = 'RSD';
|
152 |
+
}
|
153 |
+
if($this->getConfigValue('inside_delivery')){
|
154 |
+
$accArray[] = 'DID';
|
155 |
+
}
|
156 |
+
if($this->getConfigValue('liftgate')){
|
157 |
+
$accArray[] = 'DLG';
|
158 |
+
}
|
159 |
+
if($this->getConfigValue('dest_notify')){
|
160 |
+
$accArray[] = 'DNC';
|
161 |
+
}
|
162 |
+
return $accArray;
|
163 |
+
}
|
164 |
+
}
|
165 |
+
|
166 |
+
|
167 |
+
|
168 |
+
?>
|
app/code/local/Raveinfosys/Freightshipping/Model/Carrier/Rlcarriers.php
ADDED
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Raveinfosys_Freightshipping_Model_Carrier_Rlcarriers extends Raveinfosys_Freightshipping_Model_Carrier_Abstract
|
3 |
+
{
|
4 |
+
/* Shipping Carrier Code */
|
5 |
+
protected $_code = 'rlcarriers';
|
6 |
+
|
7 |
+
/* API Key to get request quote access*/
|
8 |
+
protected $_apiKey = null;
|
9 |
+
|
10 |
+
/* Request quote API URL*/
|
11 |
+
protected $_apiUrl = 'http://api.rlcarriers.com/1.0.1/RateQuoteService.asmx?WSDL';
|
12 |
+
|
13 |
+
public function isTrackingAvailable()
|
14 |
+
{
|
15 |
+
return true;
|
16 |
+
}
|
17 |
+
|
18 |
+
public function getTrackingInfo($tracking)
|
19 |
+
{
|
20 |
+
$track = Mage::getModel('shipping/tracking_result_status');
|
21 |
+
$track->setUrl('http://www2.rlcarriers.com/freight/shipping/shipment-tracing')
|
22 |
+
->setTracking($tracking)
|
23 |
+
->setCarrierTitle($this->getStoreConfig('title', $this->_code));
|
24 |
+
return $track;
|
25 |
+
}
|
26 |
+
|
27 |
+
public function getRates(Mage_Shipping_Model_Rate_Request $request)
|
28 |
+
{
|
29 |
+
if(!$this->getConfigValue('active', $this->_code)){
|
30 |
+
return;
|
31 |
+
}
|
32 |
+
try {
|
33 |
+
/******Set defualt module config data*******/
|
34 |
+
if(!($_originZip = $this->getConfigValue('origin'))){
|
35 |
+
$_originZip = Mage::getStoreConfig('shipping/origin/postcode');
|
36 |
+
}
|
37 |
+
$_defaultShipClass = $this->getConfigValue('shipclass');
|
38 |
+
$this->_apiKey = Mage::helper('core')->decrypt($this->getConfigValue('apikey', $this->_code));
|
39 |
+
if(!$this->_apiKey){
|
40 |
+
return false;
|
41 |
+
}
|
42 |
+
$_rlcRequest["APIKey"] = $this->_apiKey;
|
43 |
+
$_rlcRequest["QuoteType"] = "Domestic";
|
44 |
+
$_rlcRequest["CODAmount"] = "0";
|
45 |
+
$_rlcRequest["Origin"] = array(
|
46 |
+
"City" => "",
|
47 |
+
"StateOrProvince" => "",
|
48 |
+
"ZipOrPostalCode" => $_originZip,
|
49 |
+
"CountryCode" => $this->getCountryIso3Code($request->getCountryId())
|
50 |
+
);
|
51 |
+
$_rlcRequest["Destination"] = array(
|
52 |
+
"City" => "",
|
53 |
+
"StateOrProvince" => "",
|
54 |
+
"ZipOrPostalCode" => $request->getDestPostcode(),
|
55 |
+
"CountryCode" => $this->getCountryIso3Code($request->getDestCountryId()),
|
56 |
+
);
|
57 |
+
$_rlcRequest["DeclaredValue"] = 0;
|
58 |
+
|
59 |
+
$_rlcRequest["OverDimensionPcs"] = 0;
|
60 |
+
|
61 |
+
$items = array();
|
62 |
+
|
63 |
+
$_debugData = array();
|
64 |
+
|
65 |
+
$cn = 0;
|
66 |
+
foreach ($request->getAllItems() as $_item) {
|
67 |
+
|
68 |
+
if ($_item->getProduct()->isVirtual() || $_item->getParentItem()) {
|
69 |
+
continue;
|
70 |
+
}
|
71 |
+
|
72 |
+
if($_item->getHasChildren()){
|
73 |
+
foreach ($_item->getChildren() as $child){
|
74 |
+
if($child->getProduct()->isVirtual()){
|
75 |
+
continue;
|
76 |
+
}
|
77 |
+
$_product = Mage::getModel('catalog/product')->load($child->getProductId());
|
78 |
+
$items[$cn]['Class'] = (float)($_product->getFreightClass() ? $_product->getFreightClass() : $_defaultShipClass);
|
79 |
+
$items[$cn]['Weight'] = (float)ceil($_product->getWeight()*$_item->getQty());
|
80 |
+
$items[$cn]['Height'] = (float)$_product->getFreightWidth();
|
81 |
+
$items[$cn]['Width'] = (float)$_product->getFreightHeight();
|
82 |
+
$items[$cn]['Length'] = (float)$_product->getFreightLength();
|
83 |
+
$cn++;
|
84 |
+
}
|
85 |
+
} else {
|
86 |
+
$_product = Mage::getModel('catalog/product')->load($_item->getProduct()->getId());
|
87 |
+
$items[$cn]['Class'] = (float)($_product->getFreightClass() ? $_product->getFreightClass() : $_defaultShipClass);
|
88 |
+
$items[$cn]['Weight'] = (float)ceil($_product->getWeight()*$_item->getQty());
|
89 |
+
$items[$cn]['Height'] = (float)$_product->getFreightWidth();
|
90 |
+
$items[$cn]['Width'] = (float)$_product->getFreightHeight();
|
91 |
+
$items[$cn]['Length'] = (float)$_product->getFreightLength();
|
92 |
+
$cn++;
|
93 |
+
}
|
94 |
+
}
|
95 |
+
|
96 |
+
$_rlcRequest["Accessorials"] = $this->getAccessorialServices();
|
97 |
+
|
98 |
+
$_rlcRequest["Items"] = $items;
|
99 |
+
|
100 |
+
$_debugData['request'] = $_rlcRequest;
|
101 |
+
|
102 |
+
try {
|
103 |
+
$client = new SoapClient($this->_apiUrl);
|
104 |
+
$response = $client->GetRateQuote(array("APIKey"=> $this->_apiKey, "request" => $_rlcRequest) );
|
105 |
+
unset($client);
|
106 |
+
if(!$response->GetRateQuoteResult->WasSuccess){
|
107 |
+
$_debugData['Error'] = (array)$response;
|
108 |
+
$this->debugData($_debugData);
|
109 |
+
return false;
|
110 |
+
}
|
111 |
+
$_results = $this->parseXmlResponse($response);
|
112 |
+
|
113 |
+
} catch(SoapFault $fault) {
|
114 |
+
$_debugData['Exception'] = $fault;
|
115 |
+
$this->debugData($_debugData);
|
116 |
+
return false;
|
117 |
+
}
|
118 |
+
|
119 |
+
$_debugData['result'] = $_results;
|
120 |
+
|
121 |
+
$this->debugData($_debugData);
|
122 |
+
|
123 |
+
return $_results;
|
124 |
+
} catch(Exception $e) {
|
125 |
+
Mage::log($e->getMessage());
|
126 |
+
return false;
|
127 |
+
}
|
128 |
+
}
|
129 |
+
|
130 |
+
public function parseXmlResponse($response){
|
131 |
+
$_rates = array();
|
132 |
+
$_result = $response->GetRateQuoteResult->Result;
|
133 |
+
$_rlcRates = $_result->ServiceLevels->ServiceLevel;
|
134 |
+
$_allowdMethods = $this->getConfigValue('allowed_methods', $this->_code);
|
135 |
+
if(is_array($_rlcRates)){
|
136 |
+
$_methods = explode(',', $_allowdMethods);
|
137 |
+
foreach($_rlcRates as $_rlcRate){
|
138 |
+
if(!in_array($_rlcRate->Code, $_methods)){
|
139 |
+
continue;
|
140 |
+
}
|
141 |
+
$_rate = preg_replace('/[^0-9.]* /', '', str_replace('$','',$_rlcRate->NetCharge));
|
142 |
+
$_rates[] = array('rates' => $_rate, 'method' => $_rlcRate->Title, 'code' => $_rlcRate->Code, 'carrier' => $this->_code);
|
143 |
+
if($this->getConfigValue('active')){
|
144 |
+
break;
|
145 |
+
}
|
146 |
+
}
|
147 |
+
} else {
|
148 |
+
$_rate = preg_replace('/[^0-9.]*/', '', str_replace('$','',$_result->ServiceLevels->ServiceLevel->NetCharge));
|
149 |
+
$_rates[] = array('rates' => $_rate, 'carrier' => $this->_code, 'method' => $_result->ServiceLevels->ServiceLevel->Title, 'code' => $_result->ServiceLevels->ServiceLevel->Code);
|
150 |
+
}
|
151 |
+
return $_rates;
|
152 |
+
}
|
153 |
+
|
154 |
+
protected function getAccessorialServices(){
|
155 |
+
$accArray = array();
|
156 |
+
if($this->getConfigValue('dest_type') == 'RES'){
|
157 |
+
$accArray[] = 'ResidentialDelivery';
|
158 |
+
}
|
159 |
+
if($this->getConfigValue('inside_delivery')){
|
160 |
+
$accArray[] = 'InsideDelivery';
|
161 |
+
}
|
162 |
+
if($this->getConfigValue('liftgate')){
|
163 |
+
$accArray[] = 'DestinationLiftgate';
|
164 |
+
}
|
165 |
+
if($this->getConfigValue('dest_notify')){
|
166 |
+
$accArray[] = 'DeliveryNotification';
|
167 |
+
}
|
168 |
+
return $accArray;
|
169 |
+
}
|
170 |
+
|
171 |
+
protected function getCountryIso3Code($_countryId){
|
172 |
+
$_coutryCollection = Mage::getModel('directory/country');
|
173 |
+
return $_coutryCollection->loadByCode($_countryId)->getIso3Code();
|
174 |
+
}
|
175 |
+
}
|
app/code/local/Raveinfosys/Freightshipping/Model/Observer.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Raveinfosys_Freightshipping_Model_Observer
|
3 |
+
{
|
4 |
+
public function saveShippingMethodBefore($evt)
|
5 |
+
{
|
6 |
+
$quote = $evt->getQuote();
|
7 |
+
|
8 |
+
if($method = $quote->getShippingAddress()->getShippingMethod()) {
|
9 |
+
|
10 |
+
$array = explode('_',$method);
|
11 |
+
|
12 |
+
if($_shippingDescription = Mage::getStoreConfig('freightshipping/'.$array[0].'/title')) {
|
13 |
+
|
14 |
+
$_description = $quote->getShippingAddress()->getShippingDescription();
|
15 |
+
|
16 |
+
$quote->getShippingAddress()->setShippingDescription(str_replace($array[0], $_shippingDescription, $_description));
|
17 |
+
}
|
18 |
+
}
|
19 |
+
}
|
20 |
+
|
21 |
+
public function updateShippingDescription($evt){
|
22 |
+
$order = $evt->getOrder();
|
23 |
+
$_order = Mage::getModel('sales/order')->load($order->getId());
|
24 |
+
if($_order->getData('shipping_method')) {
|
25 |
+
$array = explode('_',$_order->getData('shipping_method'));
|
26 |
+
if($_shippingDescription = Mage::getStoreConfig('freightshipping/'.$array[0].'/title')){
|
27 |
+
$_description = str_replace($array[0], $_shippingDescription, $_order->getData('shipping_description'));
|
28 |
+
$_order->setData('shipping_description', $_description);
|
29 |
+
$order->setData('shipping_description', $_description);
|
30 |
+
$_order->save()->unsetData();
|
31 |
+
}
|
32 |
+
}
|
33 |
+
}
|
34 |
+
}
|
app/code/local/Raveinfosys/Freightshipping/Model/Source/Conway/Country.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Raveinfosys_Freightshipping_Model_Source_Conway_Country
|
3 |
+
{
|
4 |
+
public function toOptionArray()
|
5 |
+
{
|
6 |
+
$_allowMethods = array(
|
7 |
+
array('value'=>'US', 'label'=>'United States'),
|
8 |
+
array('value'=>'CN', 'label'=>'Canada'),
|
9 |
+
);
|
10 |
+
return $_allowMethods;
|
11 |
+
}
|
12 |
+
}
|
app/code/local/Raveinfosys/Freightshipping/Model/Source/Conway/Shipcode.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Raveinfosys_Freightshipping_Model_Source_Conway_Shipcode
|
3 |
+
{
|
4 |
+
public function toOptionArray()
|
5 |
+
{
|
6 |
+
$_allowMethods = array(
|
7 |
+
array('value'=>'S', 'label'=>'S'),
|
8 |
+
array('value'=>'C', 'label'=>'C'),
|
9 |
+
array('value'=>'3', 'label'=>'3'),
|
10 |
+
);
|
11 |
+
return $_allowMethods;
|
12 |
+
}
|
13 |
+
}
|
app/code/local/Raveinfosys/Freightshipping/Model/Source/Destinationtype.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Raveinfosys_Freightshipping_Model_Source_Destinationtype
|
3 |
+
{
|
4 |
+
public function toOptionArray()
|
5 |
+
{
|
6 |
+
return array(
|
7 |
+
array('value' => 'COM', 'label' => 'Commercial'),
|
8 |
+
array('value' => 'RES', 'label' => 'Residential')
|
9 |
+
);
|
10 |
+
}
|
11 |
+
}
|
app/code/local/Raveinfosys/Freightshipping/Model/Source/Rlcarriers/Country.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Raveinfosys_Freightshipping_Model_Source_Rlcarriers_Country
|
3 |
+
{
|
4 |
+
public function toOptionArray()
|
5 |
+
{
|
6 |
+
$_allowMethods = array(
|
7 |
+
array('value'=>'USA', 'label'=>'United States'),
|
8 |
+
array('value'=>'CAN', 'label'=>'Canada'),
|
9 |
+
);
|
10 |
+
return $_allowMethods;
|
11 |
+
}
|
12 |
+
}
|
app/code/local/Raveinfosys/Freightshipping/Model/Source/Rlcarriers/Method.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Raveinfosys_Freightshipping_Model_Source_Rlcarriers_Method
|
3 |
+
{
|
4 |
+
public function toOptionArray()
|
5 |
+
{
|
6 |
+
$_allowMethods = array(
|
7 |
+
array('value'=>'STD', 'label'=>'Standard Service'),
|
8 |
+
array('value'=>'GSDS', 'label'=>'Guaranteed Service'),
|
9 |
+
array('value'=>'GSAM', 'label'=>'Guaranteed AM Service'),
|
10 |
+
array('value'=>'GSHW', 'label'=>'Guaranteed HW Service')
|
11 |
+
);
|
12 |
+
return $_allowMethods;
|
13 |
+
}
|
14 |
+
}
|
app/code/local/Raveinfosys/Freightshipping/Model/Source/Shipclass.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* */
|
3 |
+
|
4 |
+
class Raveinfosys_Freightshipping_Model_Source_Shipclass
|
5 |
+
{
|
6 |
+
public function toOptionArray()
|
7 |
+
{
|
8 |
+
$_classes = array('', 50, 55, 60, 65, 70, 85, 100, 110, 125, 150, 175, 200, 250, 300, 400, 500, 775, 925);
|
9 |
+
|
10 |
+
$_shipclassArray = array();
|
11 |
+
|
12 |
+
foreach($_classes as $_class){
|
13 |
+
|
14 |
+
$_shipclassArray[] = array(
|
15 |
+
'value'=>$_class,
|
16 |
+
'label'=>$_class
|
17 |
+
);
|
18 |
+
}
|
19 |
+
|
20 |
+
return $_shipclassArray;
|
21 |
+
}
|
22 |
+
}
|
app/code/local/Raveinfosys/Freightshipping/etc/adminhtml.xml
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<acl>
|
4 |
+
<resources>
|
5 |
+
<admin>
|
6 |
+
<children>
|
7 |
+
<system>
|
8 |
+
<children>
|
9 |
+
<config>
|
10 |
+
<children>
|
11 |
+
<freightshipping translate="title" module="freightshipping">
|
12 |
+
<title>Freight Shipping Section</title>
|
13 |
+
<sort_order>0</sort_order>
|
14 |
+
</freightshipping>
|
15 |
+
</children>
|
16 |
+
</config>
|
17 |
+
</children>
|
18 |
+
</system>
|
19 |
+
</children>
|
20 |
+
</admin>
|
21 |
+
</resources>
|
22 |
+
</acl>
|
23 |
+
</config>
|
app/code/local/Raveinfosys/Freightshipping/etc/config.xml
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Raveinfosys_Freightshipping>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Raveinfosys_Freightshipping>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<events>
|
10 |
+
<sales_quote_save_before> <!-- identifier of the event we want to catch -->
|
11 |
+
<observers>
|
12 |
+
<freightshipping> <!-- identifier of the event handler -->
|
13 |
+
<type>model</type> <!-- class method call type; valid are model, object and singleton -->
|
14 |
+
<class>freightshipping/observer</class> <!-- observers class alias -->
|
15 |
+
<method>saveShippingMethodBefore</method> <!-- observer's method to be called -->
|
16 |
+
<args></args> <!-- additional arguments passed to observer -->
|
17 |
+
</freightshipping>
|
18 |
+
</observers>
|
19 |
+
</sales_quote_save_before>
|
20 |
+
<sales_model_service_quote_submit_after> <!-- identifier of the event we want to catch -->
|
21 |
+
<observers>
|
22 |
+
<freightshipping> <!-- identifier of the event handler -->
|
23 |
+
<type>model</type> <!-- class method call type; valid are model, object and singleton -->
|
24 |
+
<class>freightshipping/observer</class> <!-- observers class alias -->
|
25 |
+
<method>updateShippingDescription</method> <!-- observer's method to be called -->
|
26 |
+
<args></args> <!-- additional arguments passed to observer -->
|
27 |
+
</freightshipping>
|
28 |
+
</observers>
|
29 |
+
</sales_model_service_quote_submit_after>
|
30 |
+
</events>
|
31 |
+
<blocks>
|
32 |
+
<checkout>
|
33 |
+
<rewrite>
|
34 |
+
<onepage_shipping_method_available>Raveinfosys_Freightshipping_Block_Onepage_Shipping_Method_Available</onepage_shipping_method_available>
|
35 |
+
</rewrite>
|
36 |
+
</checkout>
|
37 |
+
<checkout>
|
38 |
+
<rewrite>
|
39 |
+
<cart_shipping>Raveinfosys_Freightshipping_Block_Checkout_Cart_Shipping</cart_shipping>
|
40 |
+
</rewrite>
|
41 |
+
</checkout>
|
42 |
+
</blocks>
|
43 |
+
<helpers>
|
44 |
+
<freightshipping>
|
45 |
+
<class>Raveinfosys_Freightshipping_Helper</class>
|
46 |
+
</freightshipping>
|
47 |
+
</helpers>
|
48 |
+
<models>
|
49 |
+
<freightshipping>
|
50 |
+
<class>Raveinfosys_Freightshipping_Model</class>
|
51 |
+
<resourceModel>freightshipping_mysql4</resourceModel>
|
52 |
+
</freightshipping>
|
53 |
+
</models>
|
54 |
+
<resources>
|
55 |
+
<freightshipping_setup>
|
56 |
+
<setup>
|
57 |
+
<module>Raveinfosys_Freightshipping</module>
|
58 |
+
<class>Mage_Eav_Model_Entity_Setup</class>
|
59 |
+
</setup>
|
60 |
+
<connection>
|
61 |
+
<use>core_setup</use>
|
62 |
+
</connection>
|
63 |
+
</freightshipping_setup>
|
64 |
+
</resources>
|
65 |
+
</global>
|
66 |
+
<default>
|
67 |
+
<carriers>
|
68 |
+
<conway>
|
69 |
+
<active>1</active>
|
70 |
+
<title>Con-way Freight</title>
|
71 |
+
<model>freightshipping/carrier_conway</model>
|
72 |
+
</conway>
|
73 |
+
<rlcarriers>
|
74 |
+
<title>R+L Carriers</title>
|
75 |
+
<active>1</active>
|
76 |
+
<model>freightshipping/carrier_rlcarriers</model>
|
77 |
+
</rlcarriers>
|
78 |
+
<bestquote>
|
79 |
+
<active>1</active>
|
80 |
+
<model>freightshipping/carrier_bestquote</model>
|
81 |
+
</bestquote>
|
82 |
+
</carriers>
|
83 |
+
</default>
|
84 |
+
</config>
|
app/code/local/Raveinfosys/Freightshipping/etc/system.xml
ADDED
@@ -0,0 +1,392 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<raveinfosys_freightshipping translate="label" module="freightshipping">
|
5 |
+
<label>Raveinfosys Freight</label>
|
6 |
+
<sort_order>9999</sort_order>
|
7 |
+
</raveinfosys_freightshipping>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<freightshipping translate="label" module="freightshipping">
|
11 |
+
<label>Shipping Configuration</label>
|
12 |
+
<tab>raveinfosys_freightshipping</tab>
|
13 |
+
<frontend_type>text</frontend_type>
|
14 |
+
<sort_order>0</sort_order>
|
15 |
+
<show_in_default>1</show_in_default>
|
16 |
+
<show_in_website>1</show_in_website>
|
17 |
+
<show_in_store>1</show_in_store>
|
18 |
+
<groups>
|
19 |
+
<general>
|
20 |
+
<label>General Configuration</label>
|
21 |
+
<sort_order>5</sort_order>
|
22 |
+
<show_in_default>1</show_in_default>
|
23 |
+
<show_in_website>1</show_in_website>
|
24 |
+
<show_in_store>1</show_in_store>
|
25 |
+
<fields>
|
26 |
+
<active translate="label">
|
27 |
+
<label>Show Cheapest Rate Only</label>
|
28 |
+
<frontend_type>select</frontend_type>
|
29 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
30 |
+
<sort_order>5</sort_order>
|
31 |
+
<show_in_default>1</show_in_default>
|
32 |
+
<show_in_website>1</show_in_website>
|
33 |
+
<show_in_store>1</show_in_store>
|
34 |
+
<comment>If Yes, it will show only cheapest rate from all available freight quote.</comment>
|
35 |
+
</active>
|
36 |
+
<shipclass translate="label">
|
37 |
+
<label>Default Ship/Freight Class</label>
|
38 |
+
<frontend_type>text</frontend_type>
|
39 |
+
<!-- <source_model>freightshipping/source_shipclass</source_model> -->
|
40 |
+
<comment>If product's freight class is not defined.</comment>
|
41 |
+
<validate>validate-number</validate>
|
42 |
+
<sort_order>10</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 |
+
</shipclass>
|
47 |
+
<origin translate="label">
|
48 |
+
<label>Shipping Origin</label>
|
49 |
+
<frontend_type>text</frontend_type>
|
50 |
+
<comment>If empty, module will use the Configuration → Shipping Setting → Origin value</comment>
|
51 |
+
<sort_order>15</sort_order>
|
52 |
+
<show_in_default>1</show_in_default>
|
53 |
+
<show_in_website>1</show_in_website>
|
54 |
+
<show_in_store>1</show_in_store>
|
55 |
+
</origin>
|
56 |
+
<dest_type>
|
57 |
+
<label>Destination Type</label>
|
58 |
+
<frontend_type>select</frontend_type>
|
59 |
+
<source_model>freightshipping/source_destinationtype</source_model>
|
60 |
+
<sort_order>20</sort_order>
|
61 |
+
<show_in_default>1</show_in_default>
|
62 |
+
<show_in_website>1</show_in_website>
|
63 |
+
<show_in_store>1</show_in_store>
|
64 |
+
</dest_type>
|
65 |
+
<liftgate>
|
66 |
+
<label>Lift Gate Service</label>
|
67 |
+
<frontend_type>select</frontend_type>
|
68 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
69 |
+
<sort_order>25</sort_order>
|
70 |
+
<show_in_default>1</show_in_default>
|
71 |
+
<show_in_website>1</show_in_website>
|
72 |
+
<show_in_store>1</show_in_store>
|
73 |
+
</liftgate>
|
74 |
+
<inside_delivery>
|
75 |
+
<label>Inside Delivery</label>
|
76 |
+
<frontend_type>select</frontend_type>
|
77 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
78 |
+
<sort_order>30</sort_order>
|
79 |
+
<show_in_default>1</show_in_default>
|
80 |
+
<show_in_website>1</show_in_website>
|
81 |
+
<show_in_store>1</show_in_store>
|
82 |
+
</inside_delivery>
|
83 |
+
<dest_notify>
|
84 |
+
<label>Delivery Notification</label>
|
85 |
+
<frontend_type>select</frontend_type>
|
86 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
87 |
+
<sort_order>35</sort_order>
|
88 |
+
<show_in_default>1</show_in_default>
|
89 |
+
<show_in_website>1</show_in_website>
|
90 |
+
<show_in_store>1</show_in_store>
|
91 |
+
<comment>Additional fees may apply for these services.</comment>
|
92 |
+
</dest_notify>
|
93 |
+
<errormessage translate="label">
|
94 |
+
<label>Displayed Error Message</label>
|
95 |
+
<frontend_type>textarea</frontend_type>
|
96 |
+
<sort_order>75</sort_order>
|
97 |
+
<show_in_default>1</show_in_default>
|
98 |
+
<show_in_website>1</show_in_website>
|
99 |
+
<show_in_store>1</show_in_store>
|
100 |
+
</errormessage>
|
101 |
+
</fields>
|
102 |
+
</general>
|
103 |
+
<conway translate="label">
|
104 |
+
<label>Con-way Freight</label>
|
105 |
+
<frontend_type>text</frontend_type>
|
106 |
+
<sort_order>5</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 |
+
<fields>
|
111 |
+
<active translate="label">
|
112 |
+
<label>Enabled</label>
|
113 |
+
<frontend_type>select</frontend_type>
|
114 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
115 |
+
<sort_order>5</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 |
+
</active>
|
120 |
+
<title translate="label">
|
121 |
+
<label>Method Title</label>
|
122 |
+
<frontend_type>text</frontend_type>
|
123 |
+
<sort_order>10</sort_order>
|
124 |
+
<show_in_default>1</show_in_default>
|
125 |
+
<show_in_website>1</show_in_website>
|
126 |
+
<show_in_store>1</show_in_store>
|
127 |
+
</title>
|
128 |
+
<!-- <apiurl translate="label">
|
129 |
+
<label>Gateway URL</label>
|
130 |
+
<frontend_type>text</frontend_type>
|
131 |
+
<sort_order>20</sort_order>
|
132 |
+
<show_in_default>1</show_in_default>
|
133 |
+
<show_in_website>1</show_in_website>
|
134 |
+
<show_in_store>1</show_in_store>
|
135 |
+
</apiurl> -->
|
136 |
+
<userid translate="label">
|
137 |
+
<label>Username</label>
|
138 |
+
<frontend_type>obscure</frontend_type>
|
139 |
+
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
140 |
+
<sort_order>14</sort_order>
|
141 |
+
<show_in_default>1</show_in_default>
|
142 |
+
<show_in_website>1</show_in_website>
|
143 |
+
<show_in_store>1</show_in_store>
|
144 |
+
</userid>
|
145 |
+
<password translate="label">
|
146 |
+
<label>Password</label>
|
147 |
+
<frontend_type>obscure</frontend_type>
|
148 |
+
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
149 |
+
<sort_order>15</sort_order>
|
150 |
+
<show_in_default>1</show_in_default>
|
151 |
+
<show_in_website>1</show_in_website>
|
152 |
+
<show_in_store>1</show_in_store>
|
153 |
+
</password>
|
154 |
+
<shipcode translate="label">
|
155 |
+
<label>Ship Code</label>
|
156 |
+
<comment>If unsure, use "S" as default.</comment>
|
157 |
+
<frontend_type>select</frontend_type>
|
158 |
+
<source_model>freightshipping/source_conway_shipcode</source_model>
|
159 |
+
<sort_order>20</sort_order>
|
160 |
+
<show_in_default>1</show_in_default>
|
161 |
+
<show_in_website>1</show_in_website>
|
162 |
+
<show_in_store>1</show_in_store>
|
163 |
+
</shipcode>
|
164 |
+
<customerno translate="label">
|
165 |
+
<label>Customer Number</label>
|
166 |
+
<comment>Please enter your Con-way customer number, to get customer specific discount.</comment>
|
167 |
+
<frontend_type>text</frontend_type>
|
168 |
+
<sort_order>25</sort_order>
|
169 |
+
<show_in_default>1</show_in_default>
|
170 |
+
<show_in_website>1</show_in_website>
|
171 |
+
<show_in_store>1</show_in_store>
|
172 |
+
</customerno>
|
173 |
+
<min_weight translate="label">
|
174 |
+
<label>Minimum Package Weight</label>
|
175 |
+
<frontend_type>text</frontend_type>
|
176 |
+
<validate>validate-number</validate>
|
177 |
+
<sort_order>31</sort_order>
|
178 |
+
<show_in_default>1</show_in_default>
|
179 |
+
<show_in_website>1</show_in_website>
|
180 |
+
<show_in_store>1</show_in_store>
|
181 |
+
</min_weight>
|
182 |
+
<max_weight translate="label">
|
183 |
+
<label>Maximum Package Weight</label>
|
184 |
+
<frontend_type>text</frontend_type>
|
185 |
+
<validate>validate-number</validate>
|
186 |
+
<sort_order>32</sort_order>
|
187 |
+
<show_in_default>1</show_in_default>
|
188 |
+
<show_in_website>1</show_in_website>
|
189 |
+
<show_in_store>1</show_in_store>
|
190 |
+
</max_weight>
|
191 |
+
<handlingfee_type translate="label">
|
192 |
+
<label>Calculate Handling Fee</label>
|
193 |
+
<frontend_type>select</frontend_type>
|
194 |
+
<source_model>shipping/source_handlingType</source_model>
|
195 |
+
<sort_order>35</sort_order>
|
196 |
+
<show_in_default>1</show_in_default>
|
197 |
+
<show_in_website>1</show_in_website>
|
198 |
+
<show_in_store>1</show_in_store>
|
199 |
+
</handlingfee_type>
|
200 |
+
<handlingfee translate="label">
|
201 |
+
<label>Handling Fee</label>
|
202 |
+
<frontend_type>text</frontend_type>
|
203 |
+
<sort_order>40</sort_order>
|
204 |
+
<show_in_default>1</show_in_default>
|
205 |
+
<show_in_website>1</show_in_website>
|
206 |
+
<show_in_store>1</show_in_store>
|
207 |
+
</handlingfee>
|
208 |
+
<!-- <errormessage translate="label">
|
209 |
+
<label>Displayed Error Message</label>
|
210 |
+
<frontend_type>textarea</frontend_type>
|
211 |
+
<sort_order>75</sort_order>
|
212 |
+
<show_in_default>1</show_in_default>
|
213 |
+
<show_in_website>1</show_in_website>
|
214 |
+
<show_in_store>1</show_in_store>
|
215 |
+
</errormessage> -->
|
216 |
+
<sallowspecific translate="label">
|
217 |
+
<label>Ship to Applicable Countries</label>
|
218 |
+
<frontend_type>select</frontend_type>
|
219 |
+
<frontend_class>shipping-applicable-country</frontend_class>
|
220 |
+
<source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
|
221 |
+
<sort_order>80</sort_order>
|
222 |
+
<show_in_default>1</show_in_default>
|
223 |
+
<show_in_website>1</show_in_website>
|
224 |
+
<show_in_store>1</show_in_store>
|
225 |
+
</sallowspecific>
|
226 |
+
<specificcountry translate="label">
|
227 |
+
<label>Ship to Specific Countries</label>
|
228 |
+
<frontend_type>multiselect</frontend_type>
|
229 |
+
<source_model>freightshipping/source_conway_country</source_model>
|
230 |
+
<sort_order>85</sort_order>
|
231 |
+
<show_in_default>1</show_in_default>
|
232 |
+
<show_in_website>1</show_in_website>
|
233 |
+
<show_in_store>1</show_in_store>
|
234 |
+
<!-- <depends><sallowspecific>1</sallowspecific></depends> -->
|
235 |
+
</specificcountry>
|
236 |
+
<debug translate="label">
|
237 |
+
<label>Debug</label>
|
238 |
+
<frontend_type>select</frontend_type>
|
239 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
240 |
+
<sort_order>90</sort_order>
|
241 |
+
<show_in_default>1</show_in_default>
|
242 |
+
<show_in_website>1</show_in_website>
|
243 |
+
<show_in_store>1</show_in_store>
|
244 |
+
</debug>
|
245 |
+
<!-- <sort_order translate="label">
|
246 |
+
<label>Sort Order</label>
|
247 |
+
<frontend_type>text</frontend_type>
|
248 |
+
<sort_order>95</sort_order>
|
249 |
+
<show_in_default>1</show_in_default>
|
250 |
+
<show_in_website>1</show_in_website>
|
251 |
+
<show_in_store>1</show_in_store>
|
252 |
+
</sort_order> -->
|
253 |
+
</fields>
|
254 |
+
</conway>
|
255 |
+
<rlcarriers translate="label">
|
256 |
+
<label>R+L Carriers</label>
|
257 |
+
<frontend_type>text</frontend_type>
|
258 |
+
<sort_order>10</sort_order>
|
259 |
+
<show_in_default>1</show_in_default>
|
260 |
+
<show_in_website>1</show_in_website>
|
261 |
+
<show_in_store>1</show_in_store>
|
262 |
+
<fields>
|
263 |
+
<active translate="label">
|
264 |
+
<label>Enabled</label>
|
265 |
+
<frontend_type>select</frontend_type>
|
266 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
267 |
+
<sort_order>5</sort_order>
|
268 |
+
<show_in_default>1</show_in_default>
|
269 |
+
<show_in_website>1</show_in_website>
|
270 |
+
<show_in_store>1</show_in_store>
|
271 |
+
</active>
|
272 |
+
<title translate="label">
|
273 |
+
<label>Method Title</label>
|
274 |
+
<frontend_type>text</frontend_type>
|
275 |
+
<sort_order>10</sort_order>
|
276 |
+
<show_in_default>1</show_in_default>
|
277 |
+
<show_in_website>1</show_in_website>
|
278 |
+
<show_in_store>1</show_in_store>
|
279 |
+
</title>
|
280 |
+
<apikey translate="label">
|
281 |
+
<label>API Key</label>
|
282 |
+
<frontend_type>obscure</frontend_type>
|
283 |
+
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
284 |
+
<sort_order>15</sort_order>
|
285 |
+
<show_in_default>1</show_in_default>
|
286 |
+
<show_in_website>1</show_in_website>
|
287 |
+
<show_in_store>1</show_in_store>
|
288 |
+
</apikey>
|
289 |
+
<!-- <apiurl translate="label">
|
290 |
+
<label>Gateway URL</label>
|
291 |
+
<frontend_type>text</frontend_type>
|
292 |
+
<sort_order>20</sort_order>
|
293 |
+
<show_in_default>1</show_in_default>
|
294 |
+
<show_in_website>1</show_in_website>
|
295 |
+
<show_in_store>1</show_in_store>
|
296 |
+
</apiurl> -->
|
297 |
+
<min_weight translate="label">
|
298 |
+
<label>Minimum Package Weight</label>
|
299 |
+
<frontend_type>text</frontend_type>
|
300 |
+
<validate>validate-number</validate>
|
301 |
+
<sort_order>20</sort_order>
|
302 |
+
<show_in_default>1</show_in_default>
|
303 |
+
<show_in_website>1</show_in_website>
|
304 |
+
<show_in_store>1</show_in_store>
|
305 |
+
</min_weight>
|
306 |
+
<max_weight translate="label">
|
307 |
+
<label>Maximum Package Weight</label>
|
308 |
+
<frontend_type>text</frontend_type>
|
309 |
+
<validate>validate-number</validate>
|
310 |
+
<sort_order>22</sort_order>
|
311 |
+
<show_in_default>1</show_in_default>
|
312 |
+
<show_in_website>1</show_in_website>
|
313 |
+
<show_in_store>1</show_in_store>
|
314 |
+
</max_weight>
|
315 |
+
|
316 |
+
<handlingfee_type translate="label">
|
317 |
+
<label>Calculate Handling Fee</label>
|
318 |
+
<frontend_type>select</frontend_type>
|
319 |
+
<source_model>shipping/source_handlingType</source_model>
|
320 |
+
<sort_order>25</sort_order>
|
321 |
+
<show_in_default>1</show_in_default>
|
322 |
+
<show_in_website>1</show_in_website>
|
323 |
+
<show_in_store>1</show_in_store>
|
324 |
+
</handlingfee_type>
|
325 |
+
<handlingfee translate="label">
|
326 |
+
<label>Handling Fee</label>
|
327 |
+
<frontend_type>text</frontend_type>
|
328 |
+
<sort_order>30</sort_order>
|
329 |
+
<show_in_default>1</show_in_default>
|
330 |
+
<show_in_website>1</show_in_website>
|
331 |
+
<show_in_store>1</show_in_store>
|
332 |
+
</handlingfee>
|
333 |
+
<allowed_methods translate="label">
|
334 |
+
<label>Allowed Methods</label>
|
335 |
+
<frontend_type>multiselect</frontend_type>
|
336 |
+
<source_model>freightshipping/source_rlcarriers_method</source_model>
|
337 |
+
<sort_order>35</sort_order>
|
338 |
+
<show_in_default>1</show_in_default>
|
339 |
+
<show_in_website>1</show_in_website>
|
340 |
+
<show_in_store>1</show_in_store>
|
341 |
+
</allowed_methods>
|
342 |
+
<!-- <errormessage translate="label">
|
343 |
+
<label>Displayed Error Message</label>
|
344 |
+
<frontend_type>textarea</frontend_type>
|
345 |
+
<sort_order>40</sort_order>
|
346 |
+
<show_in_default>1</show_in_default>
|
347 |
+
<show_in_website>1</show_in_website>
|
348 |
+
<show_in_store>1</show_in_store>
|
349 |
+
</errormessage> -->
|
350 |
+
<sallowspecific translate="label">
|
351 |
+
<label>Ship to Applicable Countries</label>
|
352 |
+
<frontend_type>select</frontend_type>
|
353 |
+
<frontend_class>shipping-applicable-country</frontend_class>
|
354 |
+
<source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
|
355 |
+
<sort_order>45</sort_order>
|
356 |
+
<show_in_default>1</show_in_default>
|
357 |
+
<show_in_website>1</show_in_website>
|
358 |
+
<show_in_store>1</show_in_store>
|
359 |
+
</sallowspecific>
|
360 |
+
<specificcountry translate="label">
|
361 |
+
<label>Ship to Specific Countries</label>
|
362 |
+
<frontend_type>multiselect</frontend_type>
|
363 |
+
<source_model>freightshipping/source_conway_country</source_model>
|
364 |
+
<sort_order>50</sort_order>
|
365 |
+
<show_in_default>1</show_in_default>
|
366 |
+
<show_in_website>1</show_in_website>
|
367 |
+
<show_in_store>1</show_in_store>
|
368 |
+
<!-- <depends><sallowspecific>1</sallowspecific></depends> -->
|
369 |
+
</specificcountry>
|
370 |
+
<debug translate="label">
|
371 |
+
<label>Debug</label>
|
372 |
+
<frontend_type>select</frontend_type>
|
373 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
374 |
+
<sort_order>55</sort_order>
|
375 |
+
<show_in_default>1</show_in_default>
|
376 |
+
<show_in_website>1</show_in_website>
|
377 |
+
<show_in_store>1</show_in_store>
|
378 |
+
</debug>
|
379 |
+
<!-- <sort_order translate="label">
|
380 |
+
<label>Sort Order</label>
|
381 |
+
<frontend_type>text</frontend_type>
|
382 |
+
<sort_order>60</sort_order>
|
383 |
+
<show_in_default>1</show_in_default>
|
384 |
+
<show_in_website>1</show_in_website>
|
385 |
+
<show_in_store>1</show_in_store>
|
386 |
+
</sort_order> -->
|
387 |
+
</fields>
|
388 |
+
</rlcarriers>
|
389 |
+
</groups>
|
390 |
+
</freightshipping>
|
391 |
+
</sections>
|
392 |
+
</config>
|
app/code/local/Raveinfosys/Freightshipping/sql/freightshipping_setup/mysql4-install-0.0.1.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Adding Attribute Group
|
11 |
+
*/
|
12 |
+
$setup->addAttributeGroup('catalog_product', 'Default', 'Freight Shipping', 1000);
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Adding Different Attributes
|
16 |
+
*/
|
17 |
+
$attributes = array(
|
18 |
+
array('label' => 'Height','input' => 'text','type' => 'text', 'code'=>'freight_height'),
|
19 |
+
array('label' => 'Width','input' => 'text','type' => 'text', 'code'=>'freight_width'),
|
20 |
+
array('label' => 'Length','input' => 'text','type' => 'text', 'code'=>'freight_length'),
|
21 |
+
array('label' => 'Freight/Ship Class','input' => 'text','type' => 'text','code'=>'freight_class')
|
22 |
+
);
|
23 |
+
|
24 |
+
/**
|
25 |
+
* The attribute added will be displayed under the group/tab Freight Shipping in product edit page
|
26 |
+
*/
|
27 |
+
foreach($attributes as $_attribute){
|
28 |
+
if(null === Mage::getModel('catalog/resource_eav_attribute')->loadByCode('catalog_product',$_attribute['code'])->getId())
|
29 |
+
{
|
30 |
+
$_attributeData = array(
|
31 |
+
'group' => 'Freight Shipping',
|
32 |
+
'label' => $_attribute['label'],
|
33 |
+
'type' => $_attribute['type'],
|
34 |
+
'input' => $_attribute['input'],
|
35 |
+
'required' => false,
|
36 |
+
'frontend_class' => 'validate-number',
|
37 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE
|
38 |
+
);
|
39 |
+
$setup->addAttribute('catalog_product', $_attribute['code'], $_attributeData);
|
40 |
+
}
|
41 |
+
}
|
42 |
+
$installer->endSetup();
|
app/etc/modules/Raveinfosys_Freightshipping.xml
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Raveinfosys_Freightshipping>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
<depends>
|
8 |
+
<Mage_Shipping/>
|
9 |
+
</depends>
|
10 |
+
<version>0.1.0</version>
|
11 |
+
</Raveinfosys_Freightshipping>
|
12 |
+
</modules>
|
13 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Raveinfosys_Freightshipping</name>
|
4 |
+
<version>0.1.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>OSL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Raveinfosys Freightshipping</summary>
|
10 |
+
<description>Raveinfosys Freightshipping</description>
|
11 |
+
<notes>This is stable version of this extension and has been tested on various version of community editions. 
|
12 |
+
In this particular version we are supporting it to run on PHP V 5.5.X</notes>
|
13 |
+
<authors><author><name>Rave Infosys</name><user>raveinfo</user><email>magento@raveinfosys.com</email></author></authors>
|
14 |
+
<date>2015-01-30</date>
|
15 |
+
<time>06:30:34</time>
|
16 |
+
<contents><target name="magelocal"><dir name="Raveinfosys"><dir name="Freightshipping"><dir name="Block"><dir name="Checkout"><dir name="Cart"><file name="Shipping.php" hash="9f31997c24962235488aa96675176adf"/></dir></dir><dir name="Onepage"><dir name="Shipping"><dir name="Method"><file name="Available.php" hash="3e89a511024eec51b8f2433a8e38f13e"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="88f73f083da2afb81ffccc43891496fa"/></dir><dir name="Model"><dir name="Carrier"><file name="Abstract.php" hash="8488f9db8f387c3f547f6acf9c0e0079"/><file name="Bestquote.php" hash="4a6c6aafe70ef8155222c5f3f4025629"/><file name="Conway.php" hash="43f4a0c77abc90f998ce16ec29fd0e7b"/><file name="Rlcarriers.php" hash="60ae94ee4ed49432393b3dd78d0cc2f2"/></dir><file name="Observer.php" hash="13001164c18445092725d3f0cafd195f"/><dir name="Source"><dir name="Conway"><file name="Country.php" hash="333e20bda51cd8ec8b7e93e17cadfa6e"/><file name="Shipcode.php" hash="f44f28fcf4f543e74d10d7d7a7490986"/></dir><file name="Destinationtype.php" hash="ce0f59e8004b52c43df7b17523c68be2"/><dir name="Rlcarriers"><file name="Country.php" hash="23f4a272483bc99945bd49ade34fc907"/><file name="Method.php" hash="ee456489afc27d267b561953f065e0cc"/></dir><file name="Shipclass.php" hash="baf6f08fe1fc4e327f1076cba647761b"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="e361ca69bef1ee1b8b579e99bcebd809"/><file name="config.xml" hash="1619f6ddfef58f24e28b9a4d2ad4e9bb"/><file name="system.xml" hash="8bb0a409765ef74b540c96b083921711"/></dir><dir name="sql"><dir name="freightshipping_setup"><file name="mysql4-install-0.0.1.php" hash="b173341fc438b2489429ba412eccc1b7"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Raveinfosys_Freightshipping.xml" hash="a8a5aae17ad0f8fbf003486b68f020fc"/></dir></target></contents>
|
17 |
+
<compatible/>
|
18 |
+
<dependencies><required><php><min>5.2.0</min><max>5.6.3</max></php><extension><name>curl</name><min>7.16.0</min><max>7.40.0</max></extension><extension><name>soap</name><min></min><max></max></extension></required></dependencies>
|
19 |
+
</package>
|