// Merge -> revision 9221
This commit is contained in:
@@ -4,14 +4,16 @@ include_once('../../config/config.inc.php');
|
||||
include_once('../../init.php');
|
||||
include_once('../../modules/socolissimo/socolissimo.php');
|
||||
|
||||
if (!Tools::getValue('ajax'))
|
||||
die('');
|
||||
|
||||
global $cookie;
|
||||
|
||||
if (Tools::getValue('token') == sha1('socolissimo'._COOKIE_KEY_.$cookie->id_cart))
|
||||
die('INVALID TOKEN');
|
||||
|
||||
$socolissimo = new Socolissimo();
|
||||
|
||||
$result = $socolissimo->getDeliveryInfos(Context::getContext()->cart->id, Context::getContext()->customer->id);
|
||||
if (!$result)
|
||||
die('{"result" : false}');
|
||||
else
|
||||
die('{"result" : true}');
|
||||
|
||||
?>
|
||||
@@ -2,7 +2,7 @@
|
||||
<module>
|
||||
<name>socolissimo</name>
|
||||
<displayName><![CDATA[So Colissimo]]></displayName>
|
||||
<version><![CDATA[2.0]]></version>
|
||||
<version><![CDATA[2.1]]></version>
|
||||
<description><![CDATA[Offer your customers, different delivery methods with LaPoste.]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[shipping_logistics]]></tab>
|
||||
|
||||
@@ -27,13 +27,15 @@
|
||||
|
||||
require_once ('../../config/config.inc.php');
|
||||
|
||||
$onload_script = 'parent.$.fancybox.close();';
|
||||
if (Tools::isSubmit('firstcall'))
|
||||
$onload_script = 'document.getElementById(\'socoForm\').submit();';
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
|
||||
<head>
|
||||
</head>
|
||||
|
||||
<body onload="document.getElementById('socoForm').submit();">
|
||||
<body onload="<?php echo $onload_script; ?>">
|
||||
<?php
|
||||
echo '<form id="socoForm" name="form" action="'.Configuration::get('SOCOLISSIMO_URL').'" method="POST">';
|
||||
foreach($_GET as $key => $val)
|
||||
|
||||
@@ -57,7 +57,7 @@ class Socolissimo extends CarrierModule
|
||||
{
|
||||
$this->name = 'socolissimo';
|
||||
$this->tab = 'shipping_logistics';
|
||||
$this->version = '2.0';
|
||||
$this->version = '2.1';
|
||||
$this->author = 'PrestaShop';
|
||||
$this->limited_countries = array('fr');
|
||||
|
||||
@@ -109,8 +109,8 @@ class Socolissimo extends CarrierModule
|
||||
if (!parent::install() OR !Configuration::updateValue('SOCOLISSIMO_ID', NULL) OR !Configuration::updateValue('SOCOLISSIMO_KEY', NULL)
|
||||
OR !Configuration::updateValue('SOCOLISSIMO_URL', 'https://ws.colissimo.fr/pudo-fo/storeCall.do') OR !Configuration::updateValue('SOCOLISSIMO_PREPARATION_TIME', 1)
|
||||
OR !Configuration::updateValue('SOCOLISSIMO_OVERCOST', 3.6) OR !$this->registerHook('extraCarrier') OR !$this->registerHook('AdminOrder') OR !$this->registerHook('updateCarrier')
|
||||
OR !$this->registerHook('newOrder') OR !Configuration::updateValue('SOCOLISSIMO_SUP_URL', 'http://ws.colissimo.fr/supervision-pudo/supervision.jsp')
|
||||
OR !Configuration::updateValue('SOCOLISSIMO_SUP', true))
|
||||
OR !$this->registerHook('newOrder') OR !$this->registerHook('paymentTop') OR !Configuration::updateValue('SOCOLISSIMO_SUP_URL', 'http://ws.colissimo.fr/supervision-pudo/supervision.jsp')
|
||||
OR !Configuration::updateValue('SOCOLISSIMO_SUP', true) OR !Configuration::updateValue('SOCOLISSIMO_USE_FANCYBOX', true))
|
||||
return false;
|
||||
|
||||
|
||||
@@ -159,7 +159,9 @@ class Socolissimo extends CarrierModule
|
||||
OR !$this->unregisterHook('AdminOrder')
|
||||
OR !$this->unregisterHook('newOrder')
|
||||
OR !$this->unregisterHook('updateCarrier')
|
||||
OR !$this->unregisterHook('paymentTop')
|
||||
OR !Configuration::deleteByName('SOCOLISSIMO_ID')
|
||||
OR !Configuration::deleteByName('SOCOLISSIMO_USE_FANCYBOX')
|
||||
OR !Configuration::deleteByName('SOCOLISSIMO_KEY')
|
||||
OR !Configuration::deleteByName('SOCOLISSIMO_URL')
|
||||
OR !Configuration::deleteByName('SOCOLISSIMO_OVERCOST')
|
||||
@@ -270,6 +272,15 @@ class Socolissimo extends CarrierModule
|
||||
<p>' . $this->l('Url of back office SoColissimo.') . '</p>
|
||||
</div>
|
||||
|
||||
<label>'.$this->l('Fancybox').' : </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="SOCOLISSIMO_USE_FANCYBOX" id="fancybox_on" value="1" '.(Configuration::get('SOCOLISSIMO_USE_FANCYBOX') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="fancybox_on"> <img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label>
|
||||
<input type="radio" name="SOCOLISSIMO_USE_FANCYBOX" id="fancybox_off" value="0" '.(!Configuration::get('SOCOLISSIMO_USE_FANCYBOX') ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="fancybox_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
|
||||
<p>'.$this->l('If you enable this option, the page of socolissimo will displayed in a fancybox').'</p>
|
||||
</div>
|
||||
|
||||
<label>'.$this->l('Supervision').' : </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="sup_active" id="active_on" value="1" '.(Configuration::get('SOCOLISSIMO_SUP') ? 'checked="checked" ' : '').'/>
|
||||
@@ -334,6 +345,7 @@ class Socolissimo extends CarrierModule
|
||||
AND Configuration::updateValue('SOCOLISSIMO_OVERCOST', (float)(Tools::getValue('overcost')))
|
||||
AND Configuration::updateValue('SOCOLISSIMO_SUP_URL', Tools::getValue('url_sup'))
|
||||
AND Configuration::updateValue('SOCOLISSIMO_OVERCOST_TAX', Tools::getValue('id_tax_rules_group'))
|
||||
AND Configuration::updateValue('SOCOLISSIMO_USE_FANCYBOX', Tools::getValue('SOCOLISSIMO_USE_FANCYBOX'))
|
||||
AND Configuration::updateValue('SOCOLISSIMO_SUP', (int)(Tools::getValue('sup_active'))))
|
||||
{
|
||||
//save old carrier id if change
|
||||
@@ -378,7 +390,10 @@ class Socolissimo extends CarrierModule
|
||||
'CETOWN' => substr($this->upper($params['address']->city),0,32),
|
||||
'DYWEIGHT' => ((float)($params['cart']->getTotalWeight()) * 1000),
|
||||
'SIGNATURE' => htmlentities($signature,ENT_NOQUOTES, 'UTF-8'),
|
||||
'TRPARAMPLUS' => (int)($carrierSo->id),
|
||||
'carrier_id' => (int)($carrierSo->id),
|
||||
'gift' => '',
|
||||
'gift_message' => '',
|
||||
'TRPARAMPLUS' => '',
|
||||
'DYFORWARDINGCHARGES' => number_format((float)($params['cart']->getOrderShippingCost($carrierSo->id)), 2, ',', ''),
|
||||
'DYPREPARATIONTIME' => (int)(Configuration::Get('SOCOLISSIMO_PREPARATION_TIME')),
|
||||
'TRRETURNURLKO' => htmlentities($this->url,ENT_NOQUOTES, 'UTF-8'),
|
||||
@@ -389,16 +404,25 @@ class Socolissimo extends CarrierModule
|
||||
$serialsInput .= '&'.$key.'='.$val;
|
||||
$serialsInput = ltrim($serialsInput, '&');
|
||||
$row['id_carrier'] = (int)($carrierSo->id);
|
||||
$this->context->smarty->assign(array('urlSo' => Configuration::get('SOCOLISSIMO_URL').'?trReturnUrlKo='.htmlentities($this->url,ENT_NOQUOTES, 'UTF-8'),'id_carrier' => (int)($row['id_carrier']),
|
||||
'inputs' => $inputs, 'serialsInput' => $serialsInput, 'finishProcess' => $this->l('To choose SoColissimo, click on a delivery method')));
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'select_label' => $this->l('Select delivery mode'),
|
||||
'edit_label' => $this->l('Edit delivery mode'),
|
||||
'token' => sha1('socolissimo'._COOKIE_KEY_.$cookie->id_cart),
|
||||
'urlSo' => Configuration::get('SOCOLISSIMO_URL').'?trReturnUrlKo='.htmlentities($this->url,ENT_NOQUOTES, 'UTF-8'),
|
||||
'id_carrier' => (int)$row['id_carrier'],
|
||||
'inputs' => $inputs, 'serialsInput' => $serialsInput, 'finishProcess' => $this->l('To choose SoColissimo, click on a delivery method'),
|
||||
));
|
||||
|
||||
$country = new Country((int)($params['address']->id_country));
|
||||
$carriers = Carrier::getCarriers($this->context->language->id, true , false,false, NULL, Carrier::ALL_CARRIERS);
|
||||
|
||||
$carriers = Carrier::getCarriers($this->context->language->id, true , false, false, null, (defined('ALL_CARRIERS') ? ALL_CARRIERS : Carrier::ALL_CARRIERS));
|
||||
|
||||
$ids = array();
|
||||
foreach($carriers as $carrier)
|
||||
$ids[] = $carrier['id_carrier'];
|
||||
|
||||
if ($this->getDeliveryInfos($this->context->cart->id, $this->context->customer->id))
|
||||
if ($params['cart']->id_carrier == Configuration::Get('SOCOLISSIMO_CARRIER_ID') && $this->getDeliveryInfos($this->context->cart->id, $this->context->customer->id))
|
||||
$this->context->smarty->assign('already_select_delivery', true);
|
||||
else
|
||||
$this->context->smarty->assign('already_select_delivery', false);
|
||||
@@ -408,7 +432,10 @@ class Socolissimo extends CarrierModule
|
||||
AND $this->checkSoCarrierAvailable((int)(Configuration::get('SOCOLISSIMO_CARRIER_ID')))
|
||||
AND in_array((int)(Configuration::get('SOCOLISSIMO_CARRIER_ID')),$ids))
|
||||
{
|
||||
return $this->display(__FILE__, 'socolissimo_carrier.tpl');
|
||||
if (Configuration::get('PS_ORDER_PROCESS_TYPE') || Configuration::get('SOCOLISSIMO_USE_FANCYBOX'))
|
||||
return $this->display(__FILE__, 'socolissimo_fancybox.tpl');
|
||||
else
|
||||
return $this->display(__FILE__, 'socolissimo_redirect.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -497,6 +524,12 @@ class Socolissimo extends CarrierModule
|
||||
|
||||
}
|
||||
|
||||
public function hookpaymentTop($params)
|
||||
{
|
||||
if ($params['cart']->id_carrier == Configuration::Get('SOCOLISSIMO_CARRIER_ID') AND !$this->getDeliveryInfos((int)$params['cookie']->id_cart, (int)$params['cookie']->id_customer))
|
||||
$params['cart']->id_carrier = 0;
|
||||
}
|
||||
|
||||
public function make_key($ceName, $dyPraparationTime, $dyForwardingCharges, $trClientNumber, $orderId)
|
||||
{
|
||||
return sha1(Configuration::get('SOCOLISSIMO_ID').$ceName.$dyPraparationTime.$dyForwardingCharges.$trClientNumber.self::formatOrderId($orderId).Configuration::get('SOCOLISSIMO_KEY'));
|
||||
|
||||
Executable
+182
@@ -0,0 +1,182 @@
|
||||
{*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 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/afl-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: 6735 $
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
<a href="#" class="iframe" style="display:none" id="soLink"></a>
|
||||
{if isset($opc) && $opc}
|
||||
<script type="text/javascript">
|
||||
var opc = true;
|
||||
</script>
|
||||
{else}
|
||||
<script type="text/javascript">
|
||||
var opc = false;
|
||||
</script>
|
||||
{/if}
|
||||
{if isset($already_select_delivery) && $already_select_delivery}
|
||||
<script type="text/javascript">
|
||||
var already_select_delivery = true;
|
||||
</script>
|
||||
{else}
|
||||
<script type="text/javascript">
|
||||
var already_select_delivery = false;
|
||||
</script>
|
||||
{/if}
|
||||
<script type="text/javascript">
|
||||
var soInputs = new Object();
|
||||
{foreach from=$inputs item=input key=name name=myLoop}
|
||||
soInputs.{$name} = "{$input|strip_tags|addslashes}";
|
||||
{/foreach}
|
||||
|
||||
{literal}
|
||||
$('#soLink').fancybox({
|
||||
'width' : 1000,
|
||||
'height' : 700,
|
||||
'autoScale' : false,
|
||||
'centerOnScroll' : true,
|
||||
'autoDimensions' : false,
|
||||
'transitionIn' : 'none',
|
||||
'transitionOut' : 'none',
|
||||
'hideOnOverlayClick' : false,
|
||||
'hideOnContentClick' : false,
|
||||
'showCloseButton' : true,
|
||||
'showIframeLoading' : true,
|
||||
'enableEscapeButton' : true,
|
||||
'type' : 'iframe',
|
||||
onStart: function () {
|
||||
$('#soLink').attr('href', 'modules/socolissimo/redirect.php'+serialiseInput(soInputs));
|
||||
},
|
||||
onClosed : function() {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: baseDir+'/modules/socolissimo/ajax.php',
|
||||
async: false,
|
||||
cache: false,
|
||||
dataType : "json",
|
||||
data: 'token={$token"}',
|
||||
success: function(jsonData)
|
||||
{
|
||||
if (jsonData.result && !opc)
|
||||
$('#form').submit();
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
alert('TECHNICAL ERROR\nDetails:\nError thrown: ' + XMLHttpRequest + '\n' + 'Text status: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
$(document).ready(function()
|
||||
{
|
||||
var interval;
|
||||
$('input[name=id_carrier]').change(function() {
|
||||
so_click();
|
||||
});
|
||||
so_click();
|
||||
});
|
||||
|
||||
|
||||
function so_click()
|
||||
{
|
||||
if (opc)
|
||||
{
|
||||
if (!already_select_delivery)
|
||||
interval = setInterval(function()
|
||||
{
|
||||
modifyCarrierLine(false);
|
||||
},10);
|
||||
|
||||
else if (!$('#edit_socolissimo').length)
|
||||
interval = setInterval(function()
|
||||
{
|
||||
modifyCarrierLine(true);
|
||||
},10);
|
||||
}
|
||||
else if ($('#id_carrier{/literal}{$id_carrier}{literal}').is(':not(:checked)'))
|
||||
{
|
||||
$('[name=processCarrier]').unbind('click').click(function () {
|
||||
return true;
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
$('[name=processCarrier]').unbind('click').click(function () {
|
||||
if (acceptCGV())
|
||||
$("#soLink").trigger("click");
|
||||
return false;
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function modifyCarrierLine(edit)
|
||||
{
|
||||
if ($('#button_socolissimo').length != 0)
|
||||
{
|
||||
clearInterval(interval);
|
||||
// delete interval value
|
||||
interval = null;
|
||||
}
|
||||
|
||||
$('#button_socolissimo').remove();
|
||||
if (edit && $('input[name=id_carrier]:checked').attr('value') == {/literal}{$id_carrier}{literal})
|
||||
$('#id_carrier{/literal}{$id_carrier}{literal}').parent().prepend('<a style="margin-left:5px;" class="button" id="button_socolissimo" href="#" onclick="redirect();return;" >{/literal}{$edit_label}{literal}</a>');
|
||||
else
|
||||
$('#id_carrier{/literal}{$id_carrier}{literal}').parent().prepend('<a style="margin-left:5px;" class="exclusive" id="button_socolissimo" href="#" onclick="redirect();return;" >{/literal}{$select_label}{literal}</a>');
|
||||
|
||||
if (already_select_delivery)
|
||||
{
|
||||
$('#id_carrier{/literal}{$id_carrier}{literal}').css('display', 'block');
|
||||
$('#id_carrier{/literal}{$id_carrier}{literal}').css('margin', 'auto');
|
||||
$('#id_carrier{/literal}{$id_carrier}{literal}').css('margin-top', '5px');
|
||||
}
|
||||
else
|
||||
$('#id_carrier{/literal}{$id_carrier}{literal}').css('display', 'none');
|
||||
|
||||
}
|
||||
|
||||
function redirect()
|
||||
{
|
||||
document.location.href = '{/literal}{$urlSo}{literal}'+serialiseInput(soInputs);
|
||||
}
|
||||
|
||||
|
||||
function serialiseInput(inputs)
|
||||
{
|
||||
updateGiftData();
|
||||
soInputs.TRPARAMPLUS = soInputs.carrier_id+'|'+soInputs.gift+'|'+soInputs.gift_message;
|
||||
str = '?firstcall=1&';
|
||||
for ( var cle in inputs )
|
||||
str += cle+'='+inputs[cle]+'&';
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
function updateGiftData()
|
||||
{
|
||||
soInputs.gift = ($('#gift').attr('checked') ? '1' : '0' );
|
||||
soInputs.gift_message = $('#gift_message').attr('value');
|
||||
}
|
||||
|
||||
{/literal}
|
||||
</script>
|
||||
Executable
+46
@@ -0,0 +1,46 @@
|
||||
{*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 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/afl-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: 6735 $
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
<script type="text/javascript">
|
||||
{literal}
|
||||
function change_action_form()
|
||||
{
|
||||
if ($('#id_carrier{/literal}{$id_carrier}{literal}').is(':not(:checked)'))
|
||||
$('#form').attr("action", 'order.php');
|
||||
else
|
||||
$('#form').attr("action", '{/literal}{$urlSo}{literal}');
|
||||
}
|
||||
$(document).ready(function()
|
||||
{
|
||||
$('input[name=id_carrier]').change(function() {
|
||||
change_action_form();
|
||||
});
|
||||
change_action_form();
|
||||
});
|
||||
{/literal}
|
||||
</script>
|
||||
{foreach from=$inputs item=input key=name name=myLoop}
|
||||
<input type="hidden" name="{$name|escape:'htmlall':'UTF-8'}" value="{$input|strip_tags|addslashes}"/>
|
||||
{/foreach}
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -34,8 +34,8 @@ require_once(_PS_MODULE_DIR_ . 'socolissimo/socolissimo.php');
|
||||
$validReturn = array('PUDOFOID','CECIVILITY','CENAME','CEFIRSTNAME', 'CECOMPANYNAME','CEEMAIL','CEPHONENUMBER', 'DELIVERYMODE','CEADRESS1','CEADRESS2','CEADRESS3','CEADRESS4',
|
||||
'CEZIPCODE','CEDOORCODE1','CEDOORCODE2','CEENTRYPHONE','DYPREPARATIONTIME','DYFORWARDINGCHARGES','ORDERID', 'SIGNATURE','ERRORCODE','TRPARAMPLUS','TRCLIENTNUMBER','PRID','PRNAME',
|
||||
'PRCOMPLADRESS','PRADRESS1','PRADRESS2','PRZIPCODE', 'PRTOWN','CETOWN','TRADERCOMPANYNAME', 'CEDELIVERYINFORMATION', 'CEDOORCODE1', 'CEDOORCODE2');
|
||||
|
||||
//list of non-blocking error
|
||||
|
||||
//list of non-blocking error
|
||||
$nonBlockingError = array(133, 131, 517, 516, 515, 514, 513, 512, 511, 510, 509, 508, 507, 506, 505, 504, 503, 502, 501);
|
||||
|
||||
$so = new Socolissimo();
|
||||
@@ -44,20 +44,27 @@ $return = array();
|
||||
foreach ($_POST AS $key => $val)
|
||||
if (in_array(strtoupper($key),$validReturn))
|
||||
$return[strtoupper($key)] = utf8_encode(urldecode(stripslashes($val)));
|
||||
|
||||
|
||||
if (isset($return['SIGNATURE']) AND isset($return['CENAME']) AND isset($return['DYPREPARATIONTIME']) AND isset($return['DYFORWARDINGCHARGES']) AND isset($return['TRCLIENTNUMBER']) AND isset($return['ORDERID']) AND isset($return['TRCLIENTNUMBER']))
|
||||
{
|
||||
if (!isset($return['ERRORCODE']) OR $return['ERRORCODE'] == NULL OR in_array($return['ERRORCODE'],$nonBlockingError))
|
||||
{
|
||||
|
||||
{
|
||||
|
||||
if ($return['SIGNATURE'] === socolissimo::make_key($return['CENAME'],(float)($return['DYPREPARATIONTIME']),$return['DYFORWARDINGCHARGES'],$return['TRCLIENTNUMBER'], $return['ORDERID']))
|
||||
{
|
||||
if (Context::getContext()->cart->id)
|
||||
{
|
||||
if (saveOrderShippingDetails(Context::getContext()->cart->id,(int)($return['TRCLIENTNUMBER']),$return))
|
||||
{
|
||||
Context::getContext()->cart->id_carrier = (int)($_POST['TRPARAMPLUS']);
|
||||
if (!Context::getContext()->cart->update())
|
||||
{
|
||||
$cart = Context::getContext()->cart;
|
||||
$TRPARAMPLUS = explode('|', Tools::getValue('TRPARAMPLUS'));
|
||||
$cart->id_carrier = $TRPARAMPLUS[0];
|
||||
$cart->gift = (int)$TRPARAMPLUS[1];
|
||||
if ((int)$cart->gift)
|
||||
if (Validate::isMessage($TRPARAMPLUS[2]))
|
||||
$cart->gift_message = strip_tags($TRPARAMPLUS[2]);
|
||||
|
||||
if (!$cart->update())
|
||||
Tools::redirect();
|
||||
else
|
||||
Tools::redirect('index.php?controller=order&step=3');
|
||||
@@ -81,7 +88,7 @@ if (isset($return['SIGNATURE']) AND isset($return['CENAME']) AND isset($return['
|
||||
echo '<div class="alert error"><img src="' . _PS_IMG_ . 'admin/forbbiden.gif" alt="nok" /> '.$so->displaySoError('999').': ';
|
||||
$errors = explode(',', str_replace('+',',', $return['ERRORCODE']));
|
||||
foreach($errors as $error)
|
||||
echo $so->displaySoError(rtrim($error));
|
||||
echo $so->displaySoError(rtrim($error));
|
||||
echo '<p><br/>
|
||||
<a href="'.Tools::getProtocol().htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8').__PS_BASE_URI__.'order.php" class="button_small" title="Retour">« Retour
|
||||
</a></p></div>'; }
|
||||
@@ -98,15 +105,15 @@ function saveOrderShippingDetails($idCart, $idCustomer, $soParams)
|
||||
'A2P' => 'Livraison Commerce de proximité', 'MRL' => 'Livraison Commerce de proximité',
|
||||
'CIT' => 'Livraison en Cityssimo', 'ACP' => 'Agence ColiPoste', 'CDI' => 'Centre de distribution',
|
||||
'RDV' => 'Livraison sur Rendez-vous');
|
||||
|
||||
|
||||
$db = Db::getInstance();
|
||||
$db->executeS('SELECT * FROM '._DB_PREFIX_.'socolissimo_delivery_info WHERE id_cart = '.(int)($idCart).' AND id_customer ='.(int)($idCustomer));
|
||||
$numRows = (int)($db->NumRows());
|
||||
if ($numRows == 0)
|
||||
{
|
||||
{
|
||||
$sql = 'INSERT INTO '._DB_PREFIX_.'socolissimo_delivery_info
|
||||
( `id_cart`, `id_customer`, `delivery_mode`, `prid`, `prname`, `prfirstname`, `prcompladress`,
|
||||
`pradress1`, `pradress2`, `pradress3`, `pradress4`, `przipcode`, `prtown`, `cephonenumber`, `ceemail` , `cecompanyname`, `cedeliveryinformation`, `cedoorcode1`, `cedoorcode2`)
|
||||
( `id_cart`, `id_customer`, `delivery_mode`, `prid`, `prname`, `prfirstname`, `prcompladress`,
|
||||
`pradress1`, `pradress2`, `pradress3`, `pradress4`, `przipcode`, `prtown`, `cephonenumber`, `ceemail` , `cecompanyname`, `cedeliveryinformation`, `cedoorcode1`, `cedoorcode2`)
|
||||
VALUES ('.(int)($idCart).','.(int)($idCustomer).',';
|
||||
if ($soParams['DELIVERYMODE'] != 'DOM' AND $soParams['DELIVERYMODE'] != 'RDV')
|
||||
$sql .= '\''.pSQL($soParams['DELIVERYMODE']).'\''.',
|
||||
@@ -144,11 +151,11 @@ function saveOrderShippingDetails($idCart, $idCustomer, $soParams)
|
||||
'.(isset($soParams['CEDOORCODE1']) ? '\''.pSQL($soParams['CEDOORCODE1']).'\'' : '\'\'').',
|
||||
'.(isset($soParams['CEDOORCODE2']) ? '\''.pSQL($soParams['CEDOORCODE2']).'\'' : '\'\'').')';
|
||||
|
||||
if (Db::getInstance()->execute($sql))
|
||||
if (Db::getInstance()->execute($sql))
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
$table = _DB_PREFIX_.'socolissimo_delivery_info';
|
||||
$values = array();
|
||||
$values['delivery_mode'] = pSQL($soParams['DELIVERYMODE']);
|
||||
@@ -174,6 +181,7 @@ function saveOrderShippingDetails($idCart, $idCustomer, $soParams)
|
||||
}
|
||||
else
|
||||
{
|
||||
(isset($soParams['PRID']) ? $values['prid'] = pSQL($soParams['PRID']) : $values['prid'] = '');
|
||||
(isset($soParams['CENAME']) ? $values['prname'] = ucfirst(pSQL($soParams['CENAME'])) : '');
|
||||
(isset($soParams['CEFIRSTNAME']) ? $values['prfirstname'] = ucfirst(pSQL($soParams['CEFIRSTNAME'])) : '');
|
||||
(isset($soParams['CECOMPLADRESS']) ? $values['prcompladress'] = pSQL($soParams['CECOMPLADRESS']) : '');
|
||||
@@ -191,11 +199,8 @@ function saveOrderShippingDetails($idCart, $idCustomer, $soParams)
|
||||
(isset($soParams['CECOMPANYNAME']) ? $values['cecompanyname'] = pSQL($soParams['CECOMPANYNAME']) : '');
|
||||
}
|
||||
$where = ' `id_cart` =\''.(int)($idCart).'\' AND `id_customer` =\''.(int)($idCustomer).'\'';
|
||||
|
||||
|
||||
if (Db::getInstance()->autoExecute($table, $values, 'UPDATE', $where))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user