Version Notes
This version is properly tested on the following Magento CE versions: 1.5, 1.6, 1.7,1.8,1.9.* . 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.3 |
| Comparing to | |
| See all releases | |
Code changes from version 0.1.2 to 0.1.3
- app/code/local/Raveinfosys/Freightshipping/Block/Checkout/Cart/Shipping.php +9 -8
- app/code/local/Raveinfosys/Freightshipping/Block/Onepage/Shipping/Method/Available.php +12 -11
- app/code/local/Raveinfosys/Freightshipping/Helper/Data.php +21 -22
- app/code/local/Raveinfosys/Freightshipping/Model/Carrier/Abstract.php +146 -151
- app/code/local/Raveinfosys/Freightshipping/Model/Carrier/Bestquote.php +49 -48
- app/code/local/Raveinfosys/Freightshipping/Model/Carrier/Conway.php +153 -151
- app/code/local/Raveinfosys/Freightshipping/Model/Carrier/Rlcarriers.php +174 -169
- app/code/local/Raveinfosys/Freightshipping/Model/Observer.php +33 -29
- app/code/local/Raveinfosys/Freightshipping/Model/Source/Conway/Country.php +8 -5
- app/code/local/Raveinfosys/Freightshipping/Model/Source/Conway/Shipcode.php +9 -6
- app/code/local/Raveinfosys/Freightshipping/Model/Source/Destinationtype.php +7 -4
- app/code/local/Raveinfosys/Freightshipping/Model/Source/Rlcarriers/Country.php +8 -5
- app/code/local/Raveinfosys/Freightshipping/Model/Source/Rlcarriers/Method.php +10 -7
- app/code/local/Raveinfosys/Freightshipping/Model/Source/Shipclass.php +16 -13
- app/code/local/Raveinfosys/Freightshipping/etc/system.xml +3 -3
- app/code/local/Raveinfosys/Freightshipping/sql/freightshipping_setup/mysql4-install-0.0.1.php +20 -21
- package.xml +6 -7
app/code/local/Raveinfosys/Freightshipping/Block/Checkout/Cart/Shipping.php
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
<?php
|
|
|
|
| 2 |
/**
|
| 3 |
* Magento
|
| 4 |
*
|
|
@@ -23,20 +24,20 @@
|
|
| 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 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
if ($name = Mage::getStoreConfig('carriers/'
|
| 38 |
return $name;
|
| 39 |
}
|
| 40 |
return $carrierCode;
|
| 41 |
}
|
|
|
|
| 42 |
}
|
| 1 |
<?php
|
| 2 |
+
|
| 3 |
/**
|
| 4 |
* Magento
|
| 5 |
*
|
| 24 |
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
| 25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 26 |
*/
|
|
|
|
|
|
|
| 27 |
class Raveinfosys_Freightshipping_Block_Checkout_Cart_Shipping extends Mage_Checkout_Block_Cart_Shipping
|
| 28 |
{
|
| 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 |
+
|
| 43 |
}
|
app/code/local/Raveinfosys/Freightshipping/Block/Onepage/Shipping/Method/Available.php
CHANGED
|
@@ -1,18 +1,19 @@
|
|
| 1 |
<?php
|
| 2 |
-
|
| 3 |
-
|
| 4 |
{
|
| 5 |
-
|
| 6 |
-
|
|
|
|
| 7 |
$_helper = Mage::helper('freightshipping');
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
if ($name = Mage::getStoreConfig('carriers/'
|
| 13 |
return $name;
|
| 14 |
}
|
| 15 |
return $carrierCode;
|
| 16 |
}
|
| 17 |
-
|
| 18 |
-
}
|
| 1 |
<?php
|
| 2 |
+
|
| 3 |
+
class Raveinfosys_Freightshipping_Block_Onepage_Shipping_Method_Available extends Mage_Checkout_Block_Onepage_Shipping_Method_Available
|
| 4 |
{
|
| 5 |
+
|
| 6 |
+
public function getCarrierName($carrierCode)
|
| 7 |
+
{
|
| 8 |
$_helper = Mage::helper('freightshipping');
|
| 9 |
+
$_carriers = $_helper->getAvailableCarriers();
|
| 10 |
+
if (in_array($carrierCode, $_carriers) && $name = Mage::getStoreConfig('freightshipping/' . $carrierCode . '/title')) {
|
| 11 |
+
return $name;
|
| 12 |
+
}
|
| 13 |
+
if ($name = Mage::getStoreConfig('carriers/' . $carrierCode . '/title')) {
|
| 14 |
return $name;
|
| 15 |
}
|
| 16 |
return $carrierCode;
|
| 17 |
}
|
| 18 |
+
|
| 19 |
+
}
|
app/code/local/Raveinfosys/Freightshipping/Helper/Data.php
CHANGED
|
@@ -1,15 +1,15 @@
|
|
| 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 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
public function isModuleEnabled($moduleName = null)
|
| 11 |
{
|
| 12 |
-
|
| 13 |
if ($moduleName === null) {
|
| 14 |
return false;
|
| 15 |
}
|
|
@@ -17,22 +17,21 @@ class Raveinfosys_Freightshipping_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 17 |
if (!Mage::getConfig()->getNode('modules/' . $moduleName)) {
|
| 18 |
return false;
|
| 19 |
}
|
| 20 |
-
|
| 21 |
return true;
|
| 22 |
}
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
|
| 37 |
}
|
| 38 |
-
|
| 1 |
<?php
|
| 2 |
+
|
| 3 |
class Raveinfosys_Freightshipping_Helper_Data extends Mage_Core_Helper_Abstract
|
| 4 |
{
|
| 5 |
|
| 6 |
+
/**
|
| 7 |
+
* Check is module exists and enabled in global config.
|
| 8 |
+
* @param $moduleName
|
| 9 |
+
*/
|
| 10 |
+
public function isModuleEnabled($moduleName = null)
|
|
|
|
| 11 |
{
|
| 12 |
+
|
| 13 |
if ($moduleName === null) {
|
| 14 |
return false;
|
| 15 |
}
|
| 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 |
}
|
|
|
app/code/local/Raveinfosys/Freightshipping/Model/Carrier/Abstract.php
CHANGED
|
@@ -1,170 +1,165 @@
|
|
| 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 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
* Fields that should be replaced in debug with '***'
|
| 13 |
*
|
| 14 |
* @var array
|
| 15 |
*/
|
| 16 |
public $_debugReplacePrivateDataKeys = array();
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
}
|
| 97 |
-
|
| 98 |
-
/**
|
| 99 |
* Retrieve information from carrier configuration
|
| 100 |
-
*
|
| 101 |
* @return mixed
|
| 102 |
*/
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
* Log debug data to file
|
| 117 |
*
|
| 118 |
* @param mixed $debugData
|
| 119 |
*/
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
Mage::getModel('core/log_adapter', 'shipping_' . $this->_code . '.log')
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
{
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
$availableCountries = explode(','
|
| 148 |
}
|
| 149 |
-
|
| 150 |
-
|
| 151 |
}
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
}
|
| 1 |
<?php
|
| 2 |
|
| 3 |
+
abstract class Raveinfosys_Freightshipping_Model_Carrier_Abstract extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface
|
|
|
|
|
|
|
| 4 |
{
|
| 5 |
+
|
| 6 |
+
protected $_code = '';
|
| 7 |
+
protected $_result = null;
|
| 8 |
+
|
| 9 |
+
/**
|
| 10 |
* Fields that should be replaced in debug with '***'
|
| 11 |
*
|
| 12 |
* @var array
|
| 13 |
*/
|
| 14 |
public $_debugReplacePrivateDataKeys = array();
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* Collect rates for this shipping method based on information in $request
|
| 18 |
+
*
|
| 19 |
+
* @param Mage_Shipping_Model_Rate_Request $data
|
| 20 |
+
* @return Mage_Shipping_Model_Rate_Result
|
| 21 |
+
*/
|
| 22 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
| 23 |
+
{
|
| 24 |
+
if ($this->getConfigValue('active') && $this->_code != 'bestquote') {
|
| 25 |
+
return false;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
if (!$this->checkAllowedShipCountries($request->getDestCountryId()) || !$this->isPackageWeightAllowed($request->getPackageWeight())) {
|
| 29 |
+
return false;
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
$this->_result = $this->getRates($request);
|
| 33 |
+
|
| 34 |
+
return $this->getResult();
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
public function getResult()
|
| 38 |
+
{
|
| 39 |
+
if ($this->_result) {
|
| 40 |
+
$result = Mage::getModel('shipping/rate_result');
|
| 41 |
+
foreach ($this->_result as $_method) {
|
| 42 |
+
$finalRates = $this->calculateHandlingFee($_method['rates']);
|
| 43 |
+
$method = Mage::getModel('shipping/rate_result_method');
|
| 44 |
+
$method->setCarrier($_method['carrier']);
|
| 45 |
+
$method->setCarrierTitle($_method['carrier']);
|
| 46 |
+
$method->setMethod($_method['code']);
|
| 47 |
+
$method->setMethodTitle($_method['method']);
|
| 48 |
+
$method->setPrice($finalRates);
|
| 49 |
+
$method->setCost($finalRates);
|
| 50 |
+
$result->append($method);
|
| 51 |
+
}
|
| 52 |
+
} elseif ($this->_result === false) {
|
| 53 |
+
$error = Mage::getModel('shipping/rate_result_error');
|
| 54 |
+
$error->setCarrier($this->_code);
|
| 55 |
+
$error->setCarrierTitle(Mage::getStoreConfig($this->_configPath . '/title'));
|
| 56 |
+
$errorMsg = Mage::getStoreConfig($this->_configPath . '/errormessage');
|
| 57 |
+
$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.'));
|
| 58 |
+
return $error;
|
| 59 |
+
} else {
|
| 60 |
+
return false;
|
| 61 |
+
}
|
| 62 |
+
return $result;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
/**
|
| 66 |
+
* Get allowed shipping methods
|
| 67 |
+
*
|
| 68 |
+
* @return array
|
| 69 |
+
*/
|
| 70 |
+
public function getAllowedMethods()
|
| 71 |
+
{
|
| 72 |
+
if ($_allowdMethods = $this->getConfigValue('allowed_methods', $this->_code)) {
|
| 73 |
+
$_methods = explode(',', $_allowdMethods);
|
| 74 |
+
foreach ($_methods as $_method) {
|
| 75 |
+
$_methodArray[$_method] = $_method;
|
| 76 |
+
}
|
| 77 |
+
return $_methodArray;
|
| 78 |
+
} else {
|
| 79 |
+
return array($this->_code => $this->getConfigValue('title', $this->_code));
|
| 80 |
+
}
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
/**
|
| 84 |
+
* Get Available shipping rates
|
| 85 |
+
*
|
| 86 |
+
* @return array
|
| 87 |
+
*/
|
| 88 |
+
public function getRates(Mage_Shipping_Model_Rate_Request $request)
|
| 89 |
+
{
|
| 90 |
+
return $this->_result;
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
/**
|
|
|
|
|
|
|
|
|
|
| 94 |
* Retrieve information from carrier configuration
|
| 95 |
+
*
|
| 96 |
* @return mixed
|
| 97 |
*/
|
| 98 |
+
public function getConfigValue($_field = null, $_groupCode = null)
|
| 99 |
+
{
|
| 100 |
+
if (!$_field) {
|
| 101 |
+
return '';
|
| 102 |
+
}
|
| 103 |
+
if ($_groupCode) {
|
| 104 |
+
return Mage::getStoreConfig('freightshipping/' . $_groupCode . '/' . $_field, $this->getStore());
|
| 105 |
+
} else {
|
| 106 |
+
return Mage::getStoreConfig('freightshipping/general/' . $_field, $this->getStore());
|
| 107 |
+
}
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
/**
|
| 111 |
* Log debug data to file
|
| 112 |
*
|
| 113 |
* @param mixed $debugData
|
| 114 |
*/
|
| 115 |
+
public function debugData($debugData)
|
| 116 |
+
{
|
| 117 |
+
if ($this->getConfigValue('debug', $this->_code)) {
|
| 118 |
Mage::getModel('core/log_adapter', 'shipping_' . $this->_code . '.log')
|
| 119 |
+
->setFilterDataKeys($this->_debugReplacePrivateDataKeys)
|
| 120 |
+
->log($debugData);
|
| 121 |
+
}
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
public function calculateHandlingFee($_rates, $_code = 'F')
|
| 125 |
+
{
|
| 126 |
+
if ($this->getConfigValue('handlingfee_type', $this->_code) == 'F') {
|
| 127 |
+
$_rates = $_rates + $this->getConfigValue('handlingfee', $this->_code);
|
| 128 |
+
} elseif ($this->getConfigValue('handlingfee_type', $this->_code) == 'P') {
|
| 129 |
+
$_handlingFee = $this->getConfigValue('handlingfee', $this->_code);
|
| 130 |
+
$_rates = $_rates + ($_rates * $_handlingFee / 100);
|
| 131 |
+
}
|
| 132 |
+
return $_rates;
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
public function checkAllowedShipCountries($_countryId)
|
| 136 |
{
|
| 137 |
+
$speCountriesAllow = $this->getConfigValue('sallowspecific', $this->_code);
|
| 138 |
+
$_speCountriesFlag = false;
|
| 139 |
+
if ($speCountriesAllow && $speCountriesAllow == 1) {
|
| 140 |
+
$availableCountries = array();
|
| 141 |
+
if ($this->getConfigValue('specificcountry', $this->_code)) {
|
| 142 |
+
$availableCountries = explode(',', $this->getConfigValue('specificcountry', $this->_code));
|
| 143 |
}
|
| 144 |
+
if ($availableCountries && in_array($_countryId, $availableCountries)) {
|
| 145 |
+
$_speCountriesFlag = true;
|
| 146 |
}
|
| 147 |
+
} else {
|
| 148 |
+
if ($_countryId == 'US' || $_countryId == 'CA') {
|
| 149 |
+
$_speCountriesFlag = true;
|
| 150 |
+
}
|
| 151 |
+
}
|
| 152 |
+
return $_speCountriesFlag;
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
public function isPackageWeightAllowed($_packageWeight)
|
| 156 |
+
{
|
| 157 |
+
$_minWeight = $this->getConfigValue('min_weight', $this->_code);
|
| 158 |
+
$_maxWeight = $this->getConfigValue('max_weight', $this->_code);
|
| 159 |
+
if ($_minWeight && ($_packageWeight < $_minWeight) || $_maxWeight && ($_packageWeight > $_maxWeight)) {
|
| 160 |
+
return false;
|
| 161 |
+
}
|
| 162 |
+
return true;
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
}
|
app/code/local/Raveinfosys/Freightshipping/Model/Carrier/Bestquote.php
CHANGED
|
@@ -1,57 +1,58 @@
|
|
| 1 |
<?php
|
|
|
|
| 2 |
class Raveinfosys_Freightshipping_Model_Carrier_Bestquote extends Raveinfosys_Freightshipping_Model_Carrier_Abstract
|
| 3 |
{
|
| 4 |
-
public $_code = 'bestquote';
|
| 5 |
|
| 6 |
-
|
|
|
|
|
|
|
| 7 |
{
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
public function calculateHandlingFee($_rates,$_code)
|
| 29 |
-
{
|
| 30 |
-
if($this->getConfigValue('handlingfee_type', $_code) == 'F') {
|
| 31 |
-
$_rates = $_rates + $this->getConfigValue('handlingfee', $_code);
|
| 32 |
-
} elseif($this->getConfigValue('handlingfee_type', $_code) == 'P') {
|
| 33 |
-
$_handlingFee = $this->getConfigValue('handlingfee', $_code);
|
| 34 |
-
$_rates = $_rates + ($_rates*$_handlingFee/100);
|
| 35 |
-
}
|
| 36 |
-
return $_rates;
|
| 37 |
-
}
|
| 38 |
-
|
| 39 |
-
protected function getAvailableCarriers()
|
| 40 |
-
{
|
| 41 |
-
$_availableCarriers = array();
|
| 42 |
-
$configFile = Mage::getConfig()->getModuleDir('etc', 'Raveinfosys_Freightshipping').DS.'config.xml';
|
| 43 |
-
$string = file_get_contents($configFile);
|
| 44 |
-
$xml = simplexml_load_string($string, 'Varien_Simplexml_Element');
|
| 45 |
-
$_carriers = json_decode(json_encode($xml), true);
|
| 46 |
-
foreach($_carriers['default']['carriers'] as $key => $carrier){
|
| 47 |
-
if($key != $this->_code){
|
| 48 |
-
$_availableCarriers[$key] = $carrier['model'];
|
| 49 |
-
}
|
| 50 |
-
}
|
| 51 |
-
return $_availableCarriers;
|
| 52 |
-
}
|
| 53 |
-
}
|
| 54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
?>
|
| 1 |
<?php
|
| 2 |
+
|
| 3 |
class Raveinfosys_Freightshipping_Model_Carrier_Bestquote extends Raveinfosys_Freightshipping_Model_Carrier_Abstract
|
| 4 |
{
|
|
|
|
| 5 |
|
| 6 |
+
public $_code = 'bestquote';
|
| 7 |
+
|
| 8 |
+
public function getRates(Mage_Shipping_Model_Rate_Request $request)
|
| 9 |
{
|
| 10 |
+
if (!$this->getConfigValue('active')) {
|
| 11 |
+
return;
|
| 12 |
+
}
|
| 13 |
+
$_carriers = $this->getAvailableCarriers();
|
| 14 |
+
$_cheapestRate = 0;
|
| 15 |
+
foreach ($_carriers as $_carrier) {
|
| 16 |
+
$model = Mage::getModel($_carrier);
|
| 17 |
+
$_rates = $model->getRates($request);
|
| 18 |
+
if ($_rates) {
|
| 19 |
+
foreach ($_rates as $_rate) {
|
| 20 |
+
$_rate['rates'] = $this->calculateHandlingFee($_rate['rates'], $_rate['carrier']);
|
| 21 |
+
if ($_cheapestRate == 0 || $_cheapestRate[0]['rates'] > $_rate['rates']) {
|
| 22 |
+
$_cheapestRate = array($_rate);
|
| 23 |
+
}
|
| 24 |
+
}
|
| 25 |
+
}
|
| 26 |
+
}
|
| 27 |
+
return $_cheapestRate;
|
| 28 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
+
public function calculateHandlingFee($_rates, $_code = 'F')
|
| 31 |
+
{
|
| 32 |
+
if ($this->getConfigValue('handlingfee_type', $_code) == 'F') {
|
| 33 |
+
$_rates = $_rates + $this->getConfigValue('handlingfee', $_code);
|
| 34 |
+
} elseif ($this->getConfigValue('handlingfee_type', $_code) == 'P') {
|
| 35 |
+
$_handlingFee = $this->getConfigValue('handlingfee', $_code);
|
| 36 |
+
$_rates = $_rates + ($_rates * $_handlingFee / 100);
|
| 37 |
+
}
|
| 38 |
+
return $_rates;
|
| 39 |
+
}
|
| 40 |
|
| 41 |
+
protected function getAvailableCarriers()
|
| 42 |
+
{
|
| 43 |
+
$_availableCarriers = array();
|
| 44 |
+
$configFile = Mage::getConfig()->getModuleDir('etc', 'Raveinfosys_Freightshipping') . DS . 'config.xml';
|
| 45 |
+
$string = file_get_contents($configFile);
|
| 46 |
+
$xml = simplexml_load_string($string, 'Varien_Simplexml_Element');
|
| 47 |
+
$_carriers = json_decode(json_encode($xml), true);
|
| 48 |
+
foreach ($_carriers['default']['carriers'] as $key => $carrier) {
|
| 49 |
+
if ($key != $this->_code) {
|
| 50 |
+
$_availableCarriers[$key] = $carrier['model'];
|
| 51 |
+
}
|
| 52 |
+
}
|
| 53 |
+
return $_availableCarriers;
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
}
|
| 57 |
|
| 58 |
?>
|
app/code/local/Raveinfosys/Freightshipping/Model/Carrier/Conway.php
CHANGED
|
@@ -1,168 +1,170 @@
|
|
| 1 |
<?php
|
|
|
|
| 2 |
class Raveinfosys_Freightshipping_Model_Carrier_Conway extends Raveinfosys_Freightshipping_Model_Carrier_Abstract
|
| 3 |
{
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
|
|
|
| 31 |
|
| 32 |
public function setConwayData()
|
| 33 |
{
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
}
|
| 39 |
|
| 40 |
-
|
| 41 |
{
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
continue;
|
| 71 |
}
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
return $_results;
|
| 133 |
}
|
| 134 |
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 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 |
?>
|
| 1 |
<?php
|
| 2 |
+
|
| 3 |
class Raveinfosys_Freightshipping_Model_Carrier_Conway extends Raveinfosys_Freightshipping_Model_Carrier_Abstract
|
| 4 |
{
|
| 5 |
+
/* Shipping Carrier Code */
|
| 6 |
+
|
| 7 |
+
public $_code = 'conway';
|
| 8 |
+
|
| 9 |
+
/* Con-way test user credentials */
|
| 10 |
+
protected $_username = 'demo';
|
| 11 |
+
protected $_password = 'demo';
|
| 12 |
+
|
| 13 |
+
/* Con-way customer number & Ship code, to get customer specific discount */
|
| 14 |
+
protected $_custNmbr = null;
|
| 15 |
+
protected $_shipCode = null;
|
| 16 |
+
|
| 17 |
+
/* Con-way request quote URL */
|
| 18 |
+
protected $_requestUrl = 'https://www.con-way.com/XMLj/X-Rate';
|
| 19 |
+
|
| 20 |
+
public function isTrackingAvailable()
|
| 21 |
+
{
|
| 22 |
+
return true;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
public function getTrackingInfo($tracking)
|
| 26 |
+
{
|
| 27 |
+
$track = Mage::getModel('shipping/tracking_result_status');
|
| 28 |
+
$track->setUrl('http://www.con-way.com/webapp/manifestrpts_p_app/Tracking/Tracking.jsp')
|
| 29 |
+
->setTracking($tracking)
|
| 30 |
+
->setCarrierTitle($this->getConfigValue('title', $this->_code));
|
| 31 |
+
return $track;
|
| 32 |
+
}
|
| 33 |
|
| 34 |
public function setConwayData()
|
| 35 |
{
|
| 36 |
+
$this->_username = Mage::helper('core')->decrypt($this->getConfigValue('userid', $this->_code));
|
| 37 |
+
$this->_password = Mage::helper('core')->decrypt($this->getConfigValue('password', $this->_code));
|
| 38 |
+
$this->_custNmbr = $this->getConfigValue('customerno', $this->_code);
|
| 39 |
+
$this->_shipCode = $this->getConfigValue('shipcode', $this->_code);
|
| 40 |
}
|
| 41 |
|
| 42 |
+
public function getRates(Mage_Shipping_Model_Rate_Request $request)
|
| 43 |
{
|
| 44 |
+
if (!$this->getConfigValue('active', $this->_code)) {
|
| 45 |
+
return;
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
/* * ****Set defualt module config data****** */
|
| 49 |
+
if (!($_originZip = $this->getConfigValue('origin'))) {
|
| 50 |
+
$_originZip = Mage::getStoreConfig('shipping/origin/postcode');
|
| 51 |
+
}
|
| 52 |
+
$_defaultShipClass = $this->getConfigValue('shipclass');
|
| 53 |
+
|
| 54 |
+
$_debugData = array();
|
| 55 |
+
$this->setConwayData();
|
| 56 |
+
$accArray = array();
|
| 57 |
+
$xmlRequest = "<RateRequest>" .
|
| 58 |
+
"<OriginZip country=\"us\">" . $_originZip . "</OriginZip>" .
|
| 59 |
+
"<DestinationZip country=\"us\">" . $request->getDestPostcode() . "</DestinationZip>";
|
| 60 |
+
|
| 61 |
+
if ($this->_custNmbr) {
|
| 62 |
+
$xmlRequest .= "<CustNmbr shipcode=\"" . $this->_shipCode . "\">" . $this->_custNmbr . "</CustNmbr>";
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
/* $xmlRequest .= "<ChargeCode>P</ChargeCode>
|
| 66 |
+
<EffectiveDate>$_effectedDate</EffectiveDate>"; */
|
| 67 |
+
|
| 68 |
+
if ($request->getAllItems()) {
|
| 69 |
+
foreach ($request->getAllItems() as $_item) {
|
| 70 |
+
|
| 71 |
+
if ($_item->getProduct()->isVirtual() || $_item->getParentItem()) {
|
| 72 |
continue;
|
| 73 |
}
|
| 74 |
+
|
| 75 |
+
if ($_item->getHasChildren()) {
|
| 76 |
+
foreach ($_item->getChildren() as $child) {
|
| 77 |
+
if ($child->getProduct()->isVirtual()) {
|
| 78 |
+
continue;
|
| 79 |
+
}
|
| 80 |
+
$_product = Mage::getModel('catalog/product')->load($child->getProductId());
|
| 81 |
+
$_productWeight = ceil($_product->getWeight() * $_item->getQty());
|
| 82 |
+
$_productFreightClass = $_product->getFreightClass() ? $_product->getFreightClass() : $_defaultShipClass;
|
| 83 |
+
$xmlRequest .= "<Item>" .
|
| 84 |
+
"<CmdtyClass>" . $_productFreightClass . "</CmdtyClass>" .
|
| 85 |
+
"<Weight unit='lbs'>" . $_productWeight . "</Weight>" .
|
| 86 |
+
"</Item>";
|
| 87 |
+
}
|
| 88 |
+
} else {
|
| 89 |
+
$_product = Mage::getModel('catalog/product')->load($_item->getProductId());
|
| 90 |
+
$_productWeight = ceil($_item->getProduct()->getWeight() * $_item->getQty());
|
| 91 |
+
$_productFreightClass = $_product->getFreightClass() ? $_product->getFreightClass() : $_defaultShipClass;
|
| 92 |
+
$xmlRequest .= "<Item>" .
|
| 93 |
+
"<CmdtyClass>" . $_productFreightClass . "</CmdtyClass>" .
|
| 94 |
+
"<Weight unit='lbs'>" . $_productWeight . "</Weight>" .
|
| 95 |
+
"</Item>";
|
| 96 |
+
}
|
| 97 |
+
}
|
| 98 |
+
}
|
| 99 |
+
$accArray = $this->getAccessorialServices();
|
| 100 |
+
|
| 101 |
+
if (count($accArray) > 0) {
|
| 102 |
+
foreach ($accArray as $acc) {
|
| 103 |
+
$xmlRequest .= "<Accessorial>$acc</Accessorial>";
|
| 104 |
+
}
|
| 105 |
+
}
|
| 106 |
+
$_debugData['request'] = $xmlRequest;
|
| 107 |
+
$xmlRequest .= "</RateRequest>";
|
| 108 |
+
|
| 109 |
+
try {
|
| 110 |
+
$xmlRequest = urlencode($xmlRequest);
|
| 111 |
+
$urlConn = curl_init($this->_requestUrl);
|
| 112 |
+
curl_setopt($urlConn, CURLOPT_POST, 1);
|
| 113 |
+
curl_setopt($urlConn, CURLOPT_SSL_VERIFYPEER, false);
|
| 114 |
+
curl_setopt($urlConn, CURLOPT_HTTPHEADER, array("Content-type: application/x-www-form-urlencoded"));
|
| 115 |
+
curl_setopt($urlConn, CURLOPT_USERPWD, $this->_username . ":" . $this->_password);
|
| 116 |
+
curl_setopt($urlConn, CURLOPT_POSTFIELDS, "RateRequest=$xmlRequest");
|
| 117 |
+
ob_start();
|
| 118 |
+
curl_exec($urlConn);
|
| 119 |
+
$xmlResponse = simplexml_load_string(ob_get_contents());
|
| 120 |
+
ob_end_clean();
|
| 121 |
+
curl_close($urlConn);
|
| 122 |
+
} catch (Exception $e) {
|
| 123 |
+
return false;
|
| 124 |
+
}
|
| 125 |
+
$_debugData['result'] = $xmlResponse;
|
| 126 |
+
if ($xmlResponse->xpath('//' . 'Error')) {
|
| 127 |
+
$this->debugData($_debugData);
|
| 128 |
+
return false;
|
| 129 |
+
}
|
| 130 |
+
$_results = $this->parseXmlResponse($xmlResponse);
|
| 131 |
+
$_debugData['result'] = $_results;
|
| 132 |
+
$this->debugData($_debugData);
|
| 133 |
+
return $_results;
|
|
|
|
| 134 |
}
|
| 135 |
|
| 136 |
+
protected function parseXmlResponse($xmlResponse)
|
| 137 |
+
{
|
| 138 |
+
$_rates = array();
|
| 139 |
+
$myElements = array('NetCharge');
|
| 140 |
+
for ($i = 0; $i < count($xmlResponse->xpath('//' . $myElements[0])); $i++) {
|
| 141 |
+
foreach ($myElements as $myEl) {
|
| 142 |
+
$myVals = $xmlResponse->xpath('//' . $myEl);
|
| 143 |
+
$response[$myEl] = $myVals[$i];
|
| 144 |
+
}
|
| 145 |
+
}
|
| 146 |
+
$_rates[] = array('rates' => (float) preg_replace('/[^0-9.]*/', '', $response['NetCharge']), 'carrier' => $this->_code, 'method' => 'Conway', 'code' => $this->_code);
|
| 147 |
+
return $_rates;
|
| 148 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
|
| 150 |
+
protected function getAccessorialServices()
|
| 151 |
+
{
|
| 152 |
+
$accArray = array();
|
| 153 |
+
if ($this->getConfigValue('dest_type') == 'RES') {
|
| 154 |
+
$accArray[] = 'RSD';
|
| 155 |
+
}
|
| 156 |
+
if ($this->getConfigValue('inside_delivery')) {
|
| 157 |
+
$accArray[] = 'DID';
|
| 158 |
+
}
|
| 159 |
+
if ($this->getConfigValue('liftgate')) {
|
| 160 |
+
$accArray[] = 'DLG';
|
| 161 |
+
}
|
| 162 |
+
if ($this->getConfigValue('dest_notify')) {
|
| 163 |
+
$accArray[] = 'DNC';
|
| 164 |
+
}
|
| 165 |
+
return $accArray;
|
| 166 |
+
}
|
| 167 |
|
| 168 |
+
}
|
| 169 |
|
| 170 |
?>
|
app/code/local/Raveinfosys/Freightshipping/Model/Carrier/Rlcarriers.php
CHANGED
|
@@ -1,175 +1,180 @@
|
|
| 1 |
<?php
|
|
|
|
| 2 |
class Raveinfosys_Freightshipping_Model_Carrier_Rlcarriers extends Raveinfosys_Freightshipping_Model_Carrier_Abstract
|
| 3 |
{
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
continue;
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 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 |
-
|
| 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 |
-
}
|
| 1 |
<?php
|
| 2 |
+
|
| 3 |
class Raveinfosys_Freightshipping_Model_Carrier_Rlcarriers extends Raveinfosys_Freightshipping_Model_Carrier_Abstract
|
| 4 |
{
|
| 5 |
+
/* Shipping Carrier Code */
|
| 6 |
+
|
| 7 |
+
protected $_code = 'rlcarriers';
|
| 8 |
+
|
| 9 |
+
/* API Key to get request quote access */
|
| 10 |
+
protected $_apiKey = null;
|
| 11 |
+
|
| 12 |
+
/* Request quote API URL */
|
| 13 |
+
protected $_apiUrl = 'http://api.rlcarriers.com/1.0.1/RateQuoteService.asmx?WSDL';
|
| 14 |
+
|
| 15 |
+
public function isTrackingAvailable()
|
| 16 |
+
{
|
| 17 |
+
return true;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
public function getTrackingInfo($tracking)
|
| 21 |
+
{
|
| 22 |
+
$track = Mage::getModel('shipping/tracking_result_status');
|
| 23 |
+
$track->setUrl('http://www2.rlcarriers.com/freight/shipping/shipment-tracing')
|
| 24 |
+
->setTracking($tracking)
|
| 25 |
+
->setCarrierTitle($this->getStoreConfig('title', $this->_code));
|
| 26 |
+
return $track;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
public function getRates(Mage_Shipping_Model_Rate_Request $request)
|
| 30 |
+
{
|
| 31 |
+
if (!$this->getConfigValue('active', $this->_code)) {
|
| 32 |
+
return;
|
| 33 |
+
}
|
| 34 |
+
try {
|
| 35 |
+
/* * ****Set defualt module config data****** */
|
| 36 |
+
if (!($_originZip = $this->getConfigValue('origin'))) {
|
| 37 |
+
$_originZip = Mage::getStoreConfig('shipping/origin/postcode');
|
| 38 |
+
}
|
| 39 |
+
$_defaultShipClass = $this->getConfigValue('shipclass');
|
| 40 |
+
$this->_apiKey = Mage::helper('core')->decrypt($this->getConfigValue('apikey', $this->_code));
|
| 41 |
+
if (!$this->_apiKey) {
|
| 42 |
+
return false;
|
| 43 |
+
}
|
| 44 |
+
$_rlcRequest["APIKey"] = $this->_apiKey;
|
| 45 |
+
$_rlcRequest["QuoteType"] = "Domestic";
|
| 46 |
+
$_rlcRequest["CODAmount"] = "0";
|
| 47 |
+
$_rlcRequest["Origin"] = array(
|
| 48 |
+
"City" => "",
|
| 49 |
+
"StateOrProvince" => "",
|
| 50 |
+
"ZipOrPostalCode" => $_originZip,
|
| 51 |
+
"CountryCode" => $this->getCountryIso3Code($request->getCountryId())
|
| 52 |
+
);
|
| 53 |
+
$_rlcRequest["Destination"] = array(
|
| 54 |
+
"City" => "",
|
| 55 |
+
"StateOrProvince" => "",
|
| 56 |
+
"ZipOrPostalCode" => trim($request->getDestPostcode()),
|
| 57 |
+
"CountryCode" => $this->getCountryIso3Code($request->getDestCountryId()),
|
| 58 |
+
);
|
| 59 |
+
$_rlcRequest["DeclaredValue"] = 0;
|
| 60 |
+
|
| 61 |
+
$_rlcRequest["OverDimensionPcs"] = 0;
|
| 62 |
+
|
| 63 |
+
$items = array();
|
| 64 |
+
|
| 65 |
+
$_debugData = array();
|
| 66 |
+
|
| 67 |
+
$cn = 0;
|
| 68 |
+
foreach ($request->getAllItems() as $_item) {
|
| 69 |
+
|
| 70 |
+
if ($_item->getProduct()->isVirtual() || $_item->getParentItem()) {
|
| 71 |
+
continue;
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
if ($_item->getHasChildren()) {
|
| 75 |
+
foreach ($_item->getChildren() as $child) {
|
| 76 |
+
if ($child->getProduct()->isVirtual()) {
|
| 77 |
+
continue;
|
| 78 |
+
}
|
| 79 |
+
$_product = Mage::getModel('catalog/product')->load($child->getProductId());
|
| 80 |
+
$items[$cn]['Class'] = (float) ($_product->getFreightClass() ? $_product->getFreightClass() : $_defaultShipClass);
|
| 81 |
+
$items[$cn]['Weight'] = (float) ceil($_product->getWeight() * $_item->getQty());
|
| 82 |
+
$items[$cn]['Height'] = (float) $_product->getFreightWidth();
|
| 83 |
+
$items[$cn]['Width'] = (float) $_product->getFreightHeight();
|
| 84 |
+
$items[$cn]['Length'] = (float) $_product->getFreightLength();
|
| 85 |
+
$cn++;
|
| 86 |
+
}
|
| 87 |
+
} else {
|
| 88 |
+
$_product = Mage::getModel('catalog/product')->load($_item->getProduct()->getId());
|
| 89 |
+
$items[$cn]['Class'] = (float) ($_product->getFreightClass() ? $_product->getFreightClass() : $_defaultShipClass);
|
| 90 |
+
$items[$cn]['Weight'] = (float) ceil($_product->getWeight() * $_item->getQty());
|
| 91 |
+
$items[$cn]['Height'] = (float) $_product->getFreightWidth();
|
| 92 |
+
$items[$cn]['Width'] = (float) $_product->getFreightHeight();
|
| 93 |
+
$items[$cn]['Length'] = (float) $_product->getFreightLength();
|
| 94 |
+
$cn++;
|
| 95 |
+
}
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
$_rlcRequest["Accessorials"] = $this->getAccessorialServices();
|
| 99 |
+
|
| 100 |
+
$_rlcRequest["Items"] = $items;
|
| 101 |
+
|
| 102 |
+
$_debugData['request'] = $_rlcRequest;
|
| 103 |
+
|
| 104 |
+
try {
|
| 105 |
+
$client = new SoapClient($this->_apiUrl);
|
| 106 |
+
$response = $client->GetRateQuote(array("APIKey" => $this->_apiKey, "request" => $_rlcRequest));
|
| 107 |
+
unset($client);
|
| 108 |
+
if (!$response->GetRateQuoteResult->WasSuccess) {
|
| 109 |
+
$_debugData['Error'] = (array) $response;
|
| 110 |
+
$this->debugData($_debugData);
|
| 111 |
+
return false;
|
| 112 |
+
}
|
| 113 |
+
$_results = $this->parseXmlResponse($response);
|
| 114 |
+
} catch (SoapFault $fault) {
|
| 115 |
+
$_debugData['Exception'] = $fault;
|
| 116 |
+
$this->debugData($_debugData);
|
| 117 |
+
return false;
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
$_debugData['result'] = $_results;
|
| 121 |
+
|
| 122 |
+
$this->debugData($_debugData);
|
| 123 |
+
|
| 124 |
+
return $_results;
|
| 125 |
+
} catch (Exception $e) {
|
| 126 |
+
Mage::log($e->getMessage());
|
| 127 |
+
return false;
|
| 128 |
+
}
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
public function parseXmlResponse($response)
|
| 132 |
+
{
|
| 133 |
+
$_rates = array();
|
| 134 |
+
$_result = $response->GetRateQuoteResult->Result;
|
| 135 |
+
$_rlcRates = $_result->ServiceLevels->ServiceLevel;
|
| 136 |
+
$_allowdMethods = $this->getConfigValue('allowed_methods', $this->_code);
|
| 137 |
+
if (is_array($_rlcRates)) {
|
| 138 |
+
$_methods = explode(',', $_allowdMethods);
|
| 139 |
+
foreach ($_rlcRates as $_rlcRate) {
|
| 140 |
+
if (!in_array($_rlcRate->Code, $_methods)) {
|
| 141 |
continue;
|
| 142 |
+
}
|
| 143 |
+
$_rate = preg_replace('/[^0-9.]* /', '', str_replace('$', '', $_rlcRate->NetCharge));
|
| 144 |
+
$_rates[] = array('rates' => $_rate, 'method' => $_rlcRate->Title, 'code' => $_rlcRate->Code, 'carrier' => $this->_code);
|
| 145 |
+
if ($this->getConfigValue('active')) {
|
| 146 |
+
break;
|
| 147 |
+
}
|
| 148 |
+
}
|
| 149 |
+
} else {
|
| 150 |
+
$_rate = preg_replace('/[^0-9.]*/', '', str_replace('$', '', $_result->ServiceLevels->ServiceLevel->NetCharge));
|
| 151 |
+
$_rates[] = array('rates' => $_rate, 'carrier' => $this->_code, 'method' => $_result->ServiceLevels->ServiceLevel->Title, 'code' => $_result->ServiceLevels->ServiceLevel->Code);
|
| 152 |
+
}
|
| 153 |
+
return $_rates;
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
protected function getAccessorialServices()
|
| 157 |
+
{
|
| 158 |
+
$accArray = array();
|
| 159 |
+
if ($this->getConfigValue('dest_type') == 'RES') {
|
| 160 |
+
$accArray[] = 'ResidentialDelivery';
|
| 161 |
+
}
|
| 162 |
+
if ($this->getConfigValue('inside_delivery')) {
|
| 163 |
+
$accArray[] = 'InsideDelivery';
|
| 164 |
+
}
|
| 165 |
+
if ($this->getConfigValue('liftgate')) {
|
| 166 |
+
$accArray[] = 'DestinationLiftgate';
|
| 167 |
+
}
|
| 168 |
+
if ($this->getConfigValue('dest_notify')) {
|
| 169 |
+
$accArray[] = 'DeliveryNotification';
|
| 170 |
+
}
|
| 171 |
+
return $accArray;
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
protected function getCountryIso3Code($_countryId)
|
| 175 |
+
{
|
| 176 |
+
$_coutryCollection = Mage::getModel('directory/country');
|
| 177 |
+
return $_coutryCollection->loadByCode($_countryId)->getIso3Code();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 178 |
}
|
| 179 |
|
| 180 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Raveinfosys/Freightshipping/Model/Observer.php
CHANGED
|
@@ -1,34 +1,38 @@
|
|
| 1 |
<?php
|
|
|
|
| 2 |
class Raveinfosys_Freightshipping_Model_Observer
|
| 3 |
{
|
| 4 |
-
|
| 5 |
-
|
|
|
|
| 6 |
$quote = $evt->getQuote();
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
}
|
|
|
|
|
|
| 1 |
<?php
|
| 2 |
+
|
| 3 |
class Raveinfosys_Freightshipping_Model_Observer
|
| 4 |
{
|
| 5 |
+
|
| 6 |
+
public function saveShippingMethodBefore($evt)
|
| 7 |
+
{
|
| 8 |
$quote = $evt->getQuote();
|
| 9 |
|
| 10 |
+
if ($method = $quote->getShippingAddress()->getShippingMethod()) {
|
| 11 |
+
|
| 12 |
+
$array = explode('_', $method);
|
| 13 |
+
|
| 14 |
+
if ($_shippingDescription = Mage::getStoreConfig('freightshipping/' . $array[0] . '/title')) {
|
| 15 |
+
|
| 16 |
+
$_description = $quote->getShippingAddress()->getShippingDescription();
|
| 17 |
+
|
| 18 |
+
$quote->getShippingAddress()->setShippingDescription(str_replace($array[0], $_shippingDescription, $_description));
|
| 19 |
+
}
|
| 20 |
+
}
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
public function updateShippingDescription($evt)
|
| 24 |
+
{
|
| 25 |
+
$order = $evt->getOrder();
|
| 26 |
+
$_order = Mage::getModel('sales/order')->load($order->getId());
|
| 27 |
+
if ($_order->getData('shipping_method')) {
|
| 28 |
+
$array = explode('_', $_order->getData('shipping_method'));
|
| 29 |
+
if ($_shippingDescription = Mage::getStoreConfig('freightshipping/' . $array[0] . '/title')) {
|
| 30 |
+
$_description = str_replace($array[0], $_shippingDescription, $_order->getData('shipping_description'));
|
| 31 |
+
$_order->setData('shipping_description', $_description);
|
| 32 |
+
$order->setData('shipping_description', $_description);
|
| 33 |
+
$_order->save()->unsetData();
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
}
|
app/code/local/Raveinfosys/Freightshipping/Model/Source/Conway/Country.php
CHANGED
|
@@ -1,12 +1,15 @@
|
|
| 1 |
<?php
|
|
|
|
| 2 |
class Raveinfosys_Freightshipping_Model_Source_Conway_Country
|
| 3 |
{
|
|
|
|
| 4 |
public function toOptionArray()
|
| 5 |
-
{
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
return $_allowMethods;
|
| 11 |
}
|
|
|
|
| 12 |
}
|
| 1 |
<?php
|
| 2 |
+
|
| 3 |
class Raveinfosys_Freightshipping_Model_Source_Conway_Country
|
| 4 |
{
|
| 5 |
+
|
| 6 |
public function toOptionArray()
|
| 7 |
+
{
|
| 8 |
+
$_allowMethods = array(
|
| 9 |
+
array('value' => 'US', 'label' => 'United States'),
|
| 10 |
+
array('value' => 'CN', 'label' => 'Canada'),
|
| 11 |
+
);
|
| 12 |
return $_allowMethods;
|
| 13 |
}
|
| 14 |
+
|
| 15 |
}
|
app/code/local/Raveinfosys/Freightshipping/Model/Source/Conway/Shipcode.php
CHANGED
|
@@ -1,13 +1,16 @@
|
|
| 1 |
<?php
|
|
|
|
| 2 |
class Raveinfosys_Freightshipping_Model_Source_Conway_Shipcode
|
| 3 |
{
|
|
|
|
| 4 |
public function toOptionArray()
|
| 5 |
-
{
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
return $_allowMethods;
|
| 12 |
}
|
|
|
|
| 13 |
}
|
| 1 |
<?php
|
| 2 |
+
|
| 3 |
class Raveinfosys_Freightshipping_Model_Source_Conway_Shipcode
|
| 4 |
{
|
| 5 |
+
|
| 6 |
public function toOptionArray()
|
| 7 |
+
{
|
| 8 |
+
$_allowMethods = array(
|
| 9 |
+
array('value' => 'S', 'label' => 'S'),
|
| 10 |
+
array('value' => 'C', 'label' => 'C'),
|
| 11 |
+
array('value' => '3', 'label' => '3'),
|
| 12 |
+
);
|
| 13 |
return $_allowMethods;
|
| 14 |
}
|
| 15 |
+
|
| 16 |
}
|
app/code/local/Raveinfosys/Freightshipping/Model/Source/Destinationtype.php
CHANGED
|
@@ -1,11 +1,14 @@
|
|
| 1 |
<?php
|
|
|
|
| 2 |
class Raveinfosys_Freightshipping_Model_Source_Destinationtype
|
| 3 |
{
|
|
|
|
| 4 |
public function toOptionArray()
|
| 5 |
{
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
}
|
|
|
|
| 11 |
}
|
| 1 |
<?php
|
| 2 |
+
|
| 3 |
class Raveinfosys_Freightshipping_Model_Source_Destinationtype
|
| 4 |
{
|
| 5 |
+
|
| 6 |
public function toOptionArray()
|
| 7 |
{
|
| 8 |
+
return array(
|
| 9 |
+
array('value' => 'COM', 'label' => 'Commercial'),
|
| 10 |
+
array('value' => 'RES', 'label' => 'Residential')
|
| 11 |
+
);
|
| 12 |
}
|
| 13 |
+
|
| 14 |
}
|
app/code/local/Raveinfosys/Freightshipping/Model/Source/Rlcarriers/Country.php
CHANGED
|
@@ -1,12 +1,15 @@
|
|
| 1 |
<?php
|
|
|
|
| 2 |
class Raveinfosys_Freightshipping_Model_Source_Rlcarriers_Country
|
| 3 |
{
|
|
|
|
| 4 |
public function toOptionArray()
|
| 5 |
-
{
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
return $_allowMethods;
|
| 11 |
}
|
|
|
|
| 12 |
}
|
| 1 |
<?php
|
| 2 |
+
|
| 3 |
class Raveinfosys_Freightshipping_Model_Source_Rlcarriers_Country
|
| 4 |
{
|
| 5 |
+
|
| 6 |
public function toOptionArray()
|
| 7 |
+
{
|
| 8 |
+
$_allowMethods = array(
|
| 9 |
+
array('value' => 'USA', 'label' => 'United States'),
|
| 10 |
+
array('value' => 'CAN', 'label' => 'Canada'),
|
| 11 |
+
);
|
| 12 |
return $_allowMethods;
|
| 13 |
}
|
| 14 |
+
|
| 15 |
}
|
app/code/local/Raveinfosys/Freightshipping/Model/Source/Rlcarriers/Method.php
CHANGED
|
@@ -1,14 +1,17 @@
|
|
| 1 |
<?php
|
|
|
|
| 2 |
class Raveinfosys_Freightshipping_Model_Source_Rlcarriers_Method
|
| 3 |
{
|
|
|
|
| 4 |
public function toOptionArray()
|
| 5 |
-
{
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
return $_allowMethods;
|
| 13 |
}
|
|
|
|
| 14 |
}
|
| 1 |
<?php
|
| 2 |
+
|
| 3 |
class Raveinfosys_Freightshipping_Model_Source_Rlcarriers_Method
|
| 4 |
{
|
| 5 |
+
|
| 6 |
public function toOptionArray()
|
| 7 |
+
{
|
| 8 |
+
$_allowMethods = array(
|
| 9 |
+
array('value' => 'STD', 'label' => 'Standard Service'),
|
| 10 |
+
array('value' => 'GSDS', 'label' => 'Guaranteed Service'),
|
| 11 |
+
array('value' => 'GSAM', 'label' => 'Guaranteed AM Service'),
|
| 12 |
+
array('value' => 'GSHW', 'label' => 'Guaranteed HW Service')
|
| 13 |
+
);
|
| 14 |
return $_allowMethods;
|
| 15 |
}
|
| 16 |
+
|
| 17 |
}
|
app/code/local/Raveinfosys/Freightshipping/Model/Source/Shipclass.php
CHANGED
|
@@ -1,22 +1,25 @@
|
|
| 1 |
<?php
|
|
|
|
| 2 |
/* */
|
| 3 |
|
| 4 |
class Raveinfosys_Freightshipping_Model_Source_Shipclass
|
| 5 |
{
|
|
|
|
| 6 |
public function toOptionArray()
|
| 7 |
{
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
}
|
|
|
|
| 22 |
}
|
| 1 |
<?php
|
| 2 |
+
|
| 3 |
/* */
|
| 4 |
|
| 5 |
class Raveinfosys_Freightshipping_Model_Source_Shipclass
|
| 6 |
{
|
| 7 |
+
|
| 8 |
public function toOptionArray()
|
| 9 |
{
|
| 10 |
+
$_classes = array('', 50, 55, 60, 65, 70, 85, 100, 110, 125, 150, 175, 200, 250, 300, 400, 500, 775, 925);
|
| 11 |
+
|
| 12 |
+
$_shipclassArray = array();
|
| 13 |
+
|
| 14 |
+
foreach ($_classes as $_class) {
|
| 15 |
+
|
| 16 |
+
$_shipclassArray[] = array(
|
| 17 |
+
'value' => $_class,
|
| 18 |
+
'label' => $_class
|
| 19 |
+
);
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
return $_shipclassArray;
|
| 23 |
}
|
| 24 |
+
|
| 25 |
}
|
app/code/local/Raveinfosys/Freightshipping/etc/system.xml
CHANGED
|
@@ -1,15 +1,15 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<config>
|
| 3 |
<tabs>
|
| 4 |
-
<
|
| 5 |
<label>Raveinfosys Freight</label>
|
| 6 |
<sort_order>9999</sort_order>
|
| 7 |
-
</
|
| 8 |
</tabs>
|
| 9 |
<sections>
|
| 10 |
<freightshipping translate="label" module="freightshipping">
|
| 11 |
<label>Shipping Configuration</label>
|
| 12 |
-
<tab>
|
| 13 |
<frontend_type>text</frontend_type>
|
| 14 |
<sort_order>0</sort_order>
|
| 15 |
<show_in_default>1</show_in_default>
|
| 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>
|
app/code/local/Raveinfosys/Freightshipping/sql/freightshipping_setup/mysql4-install-0.0.1.php
CHANGED
|
@@ -15,28 +15,27 @@ $setup->addAttributeGroup('catalog_product', 'Default', 'Freight Shipping', 1000
|
|
| 15 |
* Adding Different Attributes
|
| 16 |
*/
|
| 17 |
$attributes = array(
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 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 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
}
|
| 41 |
}
|
| 42 |
-
$installer->endSetup();
|
| 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 |
+
$_attributeData = array(
|
| 30 |
+
'group' => 'Freight Shipping',
|
| 31 |
+
'label' => $_attribute['label'],
|
| 32 |
+
'type' => $_attribute['type'],
|
| 33 |
+
'input' => $_attribute['input'],
|
| 34 |
+
'required' => false,
|
| 35 |
+
'frontend_class' => 'validate-number',
|
| 36 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE
|
| 37 |
+
);
|
| 38 |
+
$setup->addAttribute('catalog_product', $_attribute['code'], $_attributeData);
|
| 39 |
+
}
|
|
|
|
| 40 |
}
|
| 41 |
+
$installer->endSetup();
|
package.xml
CHANGED
|
@@ -1,19 +1,18 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Raveinfosys_Freightshipping</name>
|
| 4 |
-
<version>0.1.
|
| 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
|
| 12 |
-
In this particular version we are supporting it to run on PHP V 5.6.X</notes>
|
| 13 |
<authors><author><name>Rave Infosys</name><user>raveinfo</user><email>magento@raveinfosys.com</email></author></authors>
|
| 14 |
-
<date>
|
| 15 |
-
<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="
|
| 17 |
<compatible/>
|
| 18 |
-
<dependencies><required><php><min>5.2.0</min><max>5.6.
|
| 19 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Raveinfosys_Freightshipping</name>
|
| 4 |
+
<version>0.1.3</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 version is properly tested on the following Magento CE versions: 1.5, 1.6, 1.7,1.8,1.9.* . In this particular version we are supporting it to run on PHP V 5.5.X.</notes>
|
|
|
|
| 12 |
<authors><author><name>Rave Infosys</name><user>raveinfo</user><email>magento@raveinfosys.com</email></author></authors>
|
| 13 |
+
<date>2016-04-07</date>
|
| 14 |
+
<time>07:22:31</time>
|
| 15 |
+
<contents><target name="magelocal"><dir name="Raveinfosys"><dir name="Freightshipping"><dir name="Block"><dir name="Checkout"><dir name="Cart"><file name="Shipping.php" hash="ebd4d77fbb8ac8695ca8aea7e1714946"/></dir></dir><dir name="Onepage"><dir name="Shipping"><dir name="Method"><file name="Available.php" hash="fcbe3d1caedf7ea8f5b475549723d4b0"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="803d0305cd1923564d8f343ad9d59877"/></dir><dir name="Model"><dir name="Carrier"><file name="Abstract.php" hash="059ca65e11dbe81d5eaba8471f88b2c3"/><file name="Bestquote.php" hash="7115e6cf12d552442ab54920f085e632"/><file name="Conway.php" hash="927d723a590fedcc8d2fc221ed2ee6e7"/><file name="Rlcarriers.php" hash="0aeac8d42e5220ab32eb70e6cca90be1"/></dir><file name="Observer.php" hash="8efe12951d91072579613f227c91d5b0"/><dir name="Source"><dir name="Conway"><file name="Country.php" hash="ba54e19dc3febcd82c20e79bf636e5f7"/><file name="Shipcode.php" hash="dba8f37e3caf892b83163fb4c8ea5493"/></dir><file name="Destinationtype.php" hash="86077a0d2dc97e142eed6eb92273268f"/><dir name="Rlcarriers"><file name="Country.php" hash="613c1be2cccf534306e021b07a125295"/><file name="Method.php" hash="1eaf19658c181c6ab9833c87f413e841"/></dir><file name="Shipclass.php" hash="1804cc373333e0b16f949abf5f663309"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="e361ca69bef1ee1b8b579e99bcebd809"/><file name="config.xml" hash="2c3dca94e319e2dd898ca231a4a6b500"/><file name="system.xml" hash="8bb0a409765ef74b540c96b083921711"/></dir><dir name="sql"><dir name="freightshipping_setup"><file name="mysql4-install-0.0.1.php" hash="5b488bb0c45ba6366f4ef6bb6e6944c9"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Raveinfosys_Freightshipping.xml" hash="a8a5aae17ad0f8fbf003486b68f020fc"/></dir></target></contents>
|
| 16 |
<compatible/>
|
| 17 |
+
<dependencies><required><php><min>5.2.0</min><max>5.6.20</max></php><extension><name>curl</name><min/><max/></extension><extension><name>soap</name><min/><max/></extension></required></dependencies>
|
| 18 |
</package>
|
