// MERGE with 1.4 r7770

This commit is contained in:
rMalie
2011-07-28 09:20:57 +00:00
parent 60b07cacb9
commit c17e7c236d
968 changed files with 26082 additions and 3937 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
<module>
<name>fedexcarrier</name>
<displayName><![CDATA[Fedex Carrier]]></displayName>
<version><![CDATA[1.0]]></version>
<version><![CDATA[1.1]]></version>
<description><![CDATA[Offer your customers, different delivery methods with Fedex]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[shipping_logistics]]></tab>
-2
View File
@@ -143,5 +143,3 @@ $_MODULE['<{fedexcarrier}prestashop>fedexcarrier_71ffd676000b4ec8ea95f4096adc3d3
$_MODULE['<{fedexcarrier}prestashop>fedexcarrier_89a9eabc8fc9335d484dcb1eb7ef4ac5'] = 'Dieser Abschnitt ermöglicht es Ihnen, eine bestimmte FEDEX Konfiguration für jedes Produkt (z. B. Verpackungsart und Zusatzkosten) zu definieren.';
$_MODULE['<{fedexcarrier}prestashop>fedexcarrier_902b0d55fddef6f8d651fe1035b7d4bd'] = 'Fehler';
$_MODULE['<{fedexcarrier}prestashop>fedexcarrier_5e303843029d99ced59415005037969d'] = 'Fedex Webservice scheint abgeschaltet zu sein, warten Sie bitte ein paar Minuten und versuchen es dann erneut';
?>
+89 -4
View File
@@ -38,6 +38,7 @@ class FedexCarrier extends CarrierModule
private $_fieldsList = array();
private $_pickupTypeList = array();
private $_packagingTypeList = array();
private $_calculModeList = array();
private $_serviceTypeList = array();
private $_dimensionUnit = '';
private $_weightUnit = '';
@@ -45,11 +46,16 @@ class FedexCarrier extends CarrierModule
private $_weightUnitList = array('KG' => 'KGS', 'KGS' => 'KGS', 'LBS' => 'LBS', 'LB' => 'LBS');
private $_moduleName = 'fedexcarrier';
/*
** Construct Method
**
*/
public function __construct()
{
$this->name = 'fedexcarrier';
$this->tab = 'shipping_logistics';
$this->version = '1.0';
$this->version = '1.1';
$this->author = 'PrestaShop';
$this->limited_countries = array('us');
@@ -73,6 +79,10 @@ class FedexCarrier extends CarrierModule
if (!Configuration::get($keyConfiguration) && !empty($name))
$warning[] = '\''.$name.'\' ';
// Check calcul mode
if (!Configuration::get('FEDEX_CARRIER_CALCUL_MODE'))
Configuration::updateValue('FEDEX_CARRIER_CALCUL_MODE', 'onepackage');
// Checking Unit
$this->_dimensionUnit = $this->_dimensionUnitList[strtoupper(Configuration::get('PS_DIMENSION_UNIT'))];
$this->_weightUnit = $this->_weightUnitList[strtoupper(Configuration::get('PS_WEIGHT_UNIT'))];
@@ -97,12 +107,15 @@ class FedexCarrier extends CarrierModule
'FEDEX_CARRIER_API_KEY' => $this->l('Fedex API Key'),
'FEDEX_CARRIER_PICKUP_TYPE' => $this->l('Fedex default pickup type'),
'FEDEX_CARRIER_PACKAGING_TYPE' => $this->l('Fedex default packaging type'),
'FEDEX_CARRIER_PACKAGING_WEIGHT' => $this->l('Packaging weight'),
'FEDEX_CARRIER_HANDLING_FEE' => $this->l('Handling fee'),
'FEDEX_CARRIER_ADDRESS1' => '',
'FEDEX_CARRIER_ADDRESS2' => '',
'FEDEX_CARRIER_POSTAL_CODE' => '',
'FEDEX_CARRIER_CITY' => '',
'FEDEX_CARRIER_STATE' => '',
'FEDEX_CARRIER_COUNTRY' => '',
'FEDEX_CARRIER_CALCUL_MODE' => '',
);
// Loading pickup type list
@@ -148,6 +161,12 @@ class FedexCarrier extends CarrierModule
'SMART_POST' => $this->l('Smart post'),
'STANDARD_OVERNIGHT' => $this->l('Standard overnight')
);
// Loading calcul mode list
$this->_calculModeList = array(
'onepackage' => $this->l('All items in one package'),
'split' => $this->l('Split one item per package')
);
}
@@ -422,6 +441,7 @@ class FedexCarrier extends CarrierModule
private function _displayFormGeneral()
{
global $cookie;
$configCurrency = new Currency((int)Configuration::get('PS_CURRENCY_DEFAULT'));
$html = '<script>
$(document).ready(function() {
@@ -463,6 +483,17 @@ class FedexCarrier extends CarrierModule
<input type="text" size="20" name="fedex_carrier_api_key" value="'.Tools::getValue('fedex_carrier_api_key', Configuration::get('FEDEX_CARRIER_API_KEY')).'" />
<p><a href="http://www.fedex.com/webtools/" target="_blank">' . $this->l('Please click here to get your Fedex API Key.') . '</a></p>
</div>
<br /><br />
<label>'.$this->l('Packaging Weight').' : </label>
<div class="margin-form">
<input type="text" size="5" name="fedex_carrier_packaging_weight" value="'.Tools::getValue('fedex_carrier_packaging_weight', Configuration::get('FEDEX_CARRIER_PACKAGING_WEIGHT')).'" />
'.Tools::getValue('ps_weight_unit', Configuration::get('PS_WEIGHT_UNIT')).'
</div>
<label>'.$this->l('Handling Fee').' : </label>
<div class="margin-form">
<input type="text" size="5" name="fedex_carrier_handling_fee" value="'.Tools::getValue('fedex_carrier_handling_fee', Configuration::get('FEDEX_CARRIER_HANDLING_FEE')).'" />
'.$configCurrency->sign.'
</div>
</fieldset>
<fieldset style="border: 0px;">
@@ -544,6 +575,15 @@ class FedexCarrier extends CarrierModule
$html .= '<option value="'.$kpackaging.'" '.($kpackaging == pSQL(Configuration::get('FEDEX_CARRIER_PACKAGING_TYPE')) ? 'selected="selected"' : '').'>'.$vkpackaging.'</option>';
$html .= '</select>
</div>
<label>'.$this->l('Calcul mode').' : </label>
<div class="margin-form">
<select name="fedex_carrier_calcul_mode">';
$idcalculmode = array();
foreach($this->_calculModeList as $kcalculmode => $vcalculmode)
$html .= '<option value="'.$kcalculmode.'" '.($kcalculmode == (Tools::getValue('fedex_carrier_calcul_mode', Configuration::get('FEDEX_CARRIER_CALCUL_MODE'))) ? 'selected="selected"' : '').'>'.$vcalculmode.'</option>';
$html .= '</select>
<p>' . $this->l('Using the calcul mode "All items in one package" will automatically use default packaging size, packaging type and delivery services. Specifics configurations for categories or product won\'t be use.') . '</p>
</div>
<label>'.$this->l('Delivery Service').' : </label>
<div class="margin-form">';
$rateServiceList = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'fedex_rate_service_code`');
@@ -623,12 +663,15 @@ class FedexCarrier extends CarrierModule
Configuration::updateValue('FEDEX_CARRIER_API_KEY', Tools::getValue('fedex_carrier_api_key'));
Configuration::updateValue('FEDEX_CARRIER_PICKUP_TYPE', Tools::getValue('fedex_carrier_pickup_type'));
Configuration::updateValue('FEDEX_CARRIER_PACKAGING_TYPE', Tools::getValue('fedex_carrier_packaging_type'));
Configuration::updateValue('FEDEX_CARRIER_PACKAGING_WEIGHT', Tools::getValue('fedex_carrier_packaging_weight'));
Configuration::updateValue('FEDEX_CARRIER_HANDLING_FEE', Tools::getValue('fedex_carrier_handling_fee'));
Configuration::updateValue('FEDEX_CARRIER_ADDRESS1', Tools::getValue('fedex_carrier_address1'));
Configuration::updateValue('FEDEX_CARRIER_ADDRESS2', Tools::getValue('fedex_carrier_address2'));
Configuration::updateValue('FEDEX_CARRIER_POSTAL_CODE', Tools::getValue('fedex_carrier_postal_code'));
Configuration::updateValue('FEDEX_CARRIER_CITY', Tools::getValue('fedex_carrier_city'));
Configuration::updateValue('FEDEX_CARRIER_STATE', Tools::getValue('fedex_carrier_state'));
Configuration::updateValue('FEDEX_CARRIER_COUNTRY', Tools::getValue('fedex_carrier_country'));
Configuration::updateValue('FEDEX_CARRIER_CALCUL_MODE', Tools::getValue('fedex_carrier_calcul_mode'));
Configuration::updateValue('PS_WEIGHT_UNIT', $this->_weightUnitList[strtoupper(Tools::getValue('ps_weight_unit'))]);
Configuration::updateValue('PS_DIMENSION_UNIT', $this->_dimensionUnitList[strtoupper(Tools::getValue('ps_dimension_unit'))]);
if (isset($this->_weightUnitList[strtoupper(Tools::getValue('ps_weight_unit'))]))
@@ -647,12 +690,15 @@ class FedexCarrier extends CarrierModule
Configuration::updateValue('FEDEX_CARRIER_METER', Tools::getValue('fedex_carrier_meter')) AND
Configuration::updateValue('FEDEX_CARRIER_PASSWORD', Tools::getValue('fedex_carrier_password')) AND
Configuration::updateValue('FEDEX_CARRIER_API_KEY', Tools::getValue('fedex_carrier_api_key')) AND
Configuration::updateValue('FEDEX_CARRIER_PACKAGING_WEIGHT', Tools::getValue('fedex_carrier_packaging_weight')) AND
Configuration::updateValue('FEDEX_CARRIER_HANDLING_FEE', Tools::getValue('fedex_carrier_handling_fee')) AND
Configuration::updateValue('FEDEX_CARRIER_PICKUP_TYPE', Tools::getValue('fedex_carrier_pickup_type')) AND
Configuration::updateValue('FEDEX_CARRIER_PACKAGING_TYPE', Tools::getValue('fedex_carrier_packaging_type')) AND
Configuration::updateValue('FEDEX_CARRIER_POSTAL_CODE', Tools::getValue('fedex_carrier_postal_code')) AND
Configuration::updateValue('FEDEX_CARRIER_CITY', Tools::getValue('fedex_carrier_city')) AND
Configuration::updateValue('FEDEX_CARRIER_STATE', Tools::getValue('fedex_carrier_state')) AND
Configuration::updateValue('FEDEX_CARRIER_COUNTRY', Tools::getValue('fedex_carrier_country')) AND
Configuration::updateValue('FEDEX_CARRIER_CALCUL_MODE', Tools::getValue('fedex_carrier_calcul_mode')) AND
Configuration::updateValue('PS_WEIGHT_UNIT', $this->_weightUnitList[strtoupper(Tools::getValue('ps_weight_unit'))]) AND
Configuration::updateValue('PS_DIMENSION_UNIT', $this->_dimensionUnitList[strtoupper(Tools::getValue('ps_dimension_unit'))]))
$this->_html .= $this->displayConfirmation($this->l('Settings updated'));
@@ -1129,7 +1175,7 @@ class FedexCarrier extends CarrierModule
<option value="0">'.$this->l('Select a product ...').'</option>';
$productsList = Db::getInstance()->ExecuteS('
SELECT pl.* FROM `'._DB_PREFIX_.'product` p
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = 2)
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)$cookie->id_lang.')
WHERE p.`active` = 1
ORDER BY pl.`name`');
foreach ($productsList as $product)
@@ -1343,7 +1389,7 @@ class FedexCarrier extends CarrierModule
foreach ($wsParams as $k => $v)
if ($k != 'products')
$paramHash .= '/'.$v;
return md5($productHash.$paramHash);
return md5($productHash.$paramHash.Configuration::get('FEDEX_CARRIER_CALCUL_MODE'));
}
public function getOrderShippingCostCache($wsParams)
@@ -1440,6 +1486,44 @@ class FedexCarrier extends CarrierModule
// Init var
$cost = 0;
// Calcul mode condition
if (Configuration::get('FEDEX_CARRIER_CALCUL_MODE') == 'onepackage')
{
$width = 0;
$height = 0;
$depth = 0;
$weight = 0;
foreach ($wsParams['products'] as $product)
{
if ($product['width'] && $product['width'] > $width) $width = $product['width'];
if ($product['height'] && $product['height'] > $height) $height = $product['height'];
if ($product['depth'] && $product['depth'] > $depth) $depth = $product['depth'];
if ($product['weight'])
$weight += ($product['weight'] * $product['quantity']);
}
$weight += Tools::getValue('fedex_carrier_packaging_weight', Configuration::get('FEDEX_CARRIER_PACKAGING_WEIGHT'));
// Get service in adequation with carrier and check if available
$servicesConfiguration = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'fedex_rate_service_code` WHERE `active` = 1');
foreach ($servicesConfiguration as $service)
$config['services'][$service['id_fedex_rate_service_code']] = $service;
$serviceSelected = Db::getInstance()->getRow('SELECT * FROM `'._DB_PREFIX_.'fedex_rate_service_code` WHERE `id_carrier` = '.(int)($this->id_carrier));
if (!isset($config['services'][$serviceSelected['id_fedex_rate_service_code']]))
return false;
$wsParams['service'] = $serviceSelected['code'];
$wsParams['package_list'] = array();
$wsParams['package_list'][] = array(
'width' => ($width > 0 ? $width : 7),
'height' => ($height > 0 ? $height : 3),
'depth' => ($depth > 0 ? $depth : 5),
'weight' => ($weight > 0 ? $weight : .5),
'packaging_type' => Configuration::get('FEDEX_CARRIER_PACKAGING_TYPE'),
);
}
else
{
// Getting shipping cost for each product
foreach ($wsParams['products'] as $product)
{
@@ -1470,12 +1554,13 @@ class FedexCarrier extends CarrierModule
$cost += ($config['additional_charges'] * $conversionRate);
}
}
}
// If webservice return a cost, we add it, else, we return the original shipping cost
$result = $this->getFedexShippingCost($wsParams);
if ($result['connect'] && $result['cost'] > 0)
return ($cost + $result['cost']);
return ($cost + $result['cost'] + Tools::getValue('fedex_carrier_handling_fee', Configuration::get('FEDEX_CARRIER_HANDLING_FEE')));
return false;
}
+8
View File
@@ -14,6 +14,8 @@ $_MODULE['<{fedexcarrier}prestashop>fedexcarrier_918356c887962073f010ee06e139571
$_MODULE['<{fedexcarrier}prestashop>fedexcarrier_8c2b826b79539fa093a6db05ca5ec9e0'] = 'Votre API Key Fedex';
$_MODULE['<{fedexcarrier}prestashop>fedexcarrier_3ef2f9d666a37f95d963a84c46bae646'] = 'Ramassage par défaut';
$_MODULE['<{fedexcarrier}prestashop>fedexcarrier_72f18dde0a5c9f75dd487adeacb92b56'] = 'Type de colis par défaut';
$_MODULE['<{fedexcarrier}prestashop>fedexcarrier_20449d3f0b6c6b9265a5cd2a470a6451'] = 'Poids du colis';
$_MODULE['<{fedexcarrier}prestashop>fedexcarrier_bfc00de34bc04366e7fee516adf7dca5'] = 'Frais supplémentaire';
$_MODULE['<{fedexcarrier}prestashop>fedexcarrier_5bb8a37c6acccadf3e28a704d59f1f8a'] = 'Business service center';
$_MODULE['<{fedexcarrier}prestashop>fedexcarrier_c0b3132d2759b40e8525f2466c477d1c'] = 'Drop box';
$_MODULE['<{fedexcarrier}prestashop>fedexcarrier_22db7528d7c5df8e310bf19af75e61d3'] = 'Regular pickup';
@@ -46,6 +48,8 @@ $_MODULE['<{fedexcarrier}prestashop>fedexcarrier_a8c786474d046ba2b2b90b78a7b498c
$_MODULE['<{fedexcarrier}prestashop>fedexcarrier_ec25bbf3daf58ec08920a781e25a3f3d'] = 'International priority freight';
$_MODULE['<{fedexcarrier}prestashop>fedexcarrier_e889962a8517669ba4ac839afa6384df'] = 'Smart post';
$_MODULE['<{fedexcarrier}prestashop>fedexcarrier_0a7bd01967a1874144b1b4fab2ee6a6f'] = 'Standard overnight';
$_MODULE['<{fedexcarrier}prestashop>fedexcarrier_386aad80d82f8245e9ef80352a2240e8'] = 'Tous les produits dans un colis';
$_MODULE['<{fedexcarrier}prestashop>fedexcarrier_f35eb2a913a3fd6fd8e661012cf0ebd8'] = 'Séparer chaque produit dans un colis';
$_MODULE['<{fedexcarrier}prestashop>fedexcarrier_d999f792aee7c730cdc95f6aff4aa436'] = 'Transporteur FEDEX';
$_MODULE['<{fedexcarrier}prestashop>fedexcarrier_99e509958c21ac35438651547a7bb035'] = 'Statut du module FEDEX';
$_MODULE['<{fedexcarrier}prestashop>fedexcarrier_d23a9177c3c7256ede85643a19335afb'] = 'Le transporteur FEDEX est fonctionnel !';
@@ -64,6 +68,8 @@ $_MODULE['<{fedexcarrier}prestashop>fedexcarrier_9a8b0ebd10992bd1576eccf605a8417
$_MODULE['<{fedexcarrier}prestashop>fedexcarrier_c36a272a8778a2e85de52a01675fd521'] = 'Votre mot de passe Fedex';
$_MODULE['<{fedexcarrier}prestashop>fedexcarrier_5e2cd475470bc7b47bef8d4ecdae2a67'] = 'Votre Fedex Key API';
$_MODULE['<{fedexcarrier}prestashop>fedexcarrier_cdfa1b01c330bf745f776f6c6c8afffd'] = 'Veuillez cliquer ici pour obtenir votre Fedex Key API';
$_MODULE['<{fedexcarrier}prestashop>fedexcarrier_db06a2900c66a3a2cb78fe3a470f1b85'] = 'Poids du colis';
$_MODULE['<{fedexcarrier}prestashop>fedexcarrier_0274f749472f365e7d48a501e14793e6'] = 'Frais supplémentaire';
$_MODULE['<{fedexcarrier}prestashop>fedexcarrier_83ad4fdaf06650e6d9d7ca18f82fb975'] = 'Configuration de localisation';
$_MODULE['<{fedexcarrier}prestashop>fedexcarrier_f489118ea95c746d648d36bb50c226f0'] = 'Unité de poids';
$_MODULE['<{fedexcarrier}prestashop>fedexcarrier_659c95668841b7d6602ead454b28d4ba'] = 'L\'unité de poids de votre magasin (ex: kg ou lb)';
@@ -85,6 +91,8 @@ $_MODULE['<{fedexcarrier}prestashop>fedexcarrier_f405714368454e1f9c932432693aea4
$_MODULE['<{fedexcarrier}prestashop>fedexcarrier_ce135482b30deedcc0046df41c12de79'] = 'Choisissez votre méthode de livraison par défault...';
$_MODULE['<{fedexcarrier}prestashop>fedexcarrier_9a361a1f786db3dfe07aae42752d3446'] = 'Type de colis par défaut';
$_MODULE['<{fedexcarrier}prestashop>fedexcarrier_4664d1ae1832bed2246e8a6850365075'] = 'Choississez un type de colis par défaut';
$_MODULE['<{fedexcarrier}prestashop>fedexcarrier_8d6bd50f3fe3ee2f4513066c25e5fb4a'] = 'Méthode de calcul';
$_MODULE['<{fedexcarrier}prestashop>fedexcarrier_c5238c5f72dee585afdf4bddf6de518e'] = 'Utiliser la méthode de calcul \"Tous les produits dans un colis\" utilisera automatiquement la taille de colis, le type de colis et les services de livraison par défaut. Les configurations spécifiques des catégories et des produits ne seront pas utilisés.';
$_MODULE['<{fedexcarrier}prestashop>fedexcarrier_5cdd307ba6e260beb4801c0c10e22a3a'] = 'Services de livraison';
$_MODULE['<{fedexcarrier}prestashop>fedexcarrier_78945de8de090e90045d299651a68a9b'] = 'Disponible';
$_MODULE['<{fedexcarrier}prestashop>fedexcarrier_2d25c72c1b18e562f6654fff8e11711e'] = 'Non disponible';
+36
View File
@@ -0,0 +1,36 @@
<?php
/*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;