コード例 #1
0
    $customer = new Customer((int) $context->cart->id_customer);
    if (Configuration::get('PS_TOKEN_ENABLE') == 1 and strcmp(Tools::getToken(false), Tools::encrypt($context->cart->id_customer . $customer->passwd . false)) and $context->customer->isLogged() === true) {
        Tools::redirectLink(__PS_BASE_URI__ . 'order.php?step=1');
    }
} else {
    $context = Context::getContext();
    $cookie = $context->cookie;
    if (Configuration::get('PS_TOKEN_ENABLE') == 1 and strcmp(Tools::getToken(false), Tools::encrypt($cookie->id_customer . $cookie->passwd . false)) and $cookie->isLogged() === true) {
        Tools::redirectLink(__PS_BASE_URI__ . 'order.php?step=1');
    }
}
// BEGIN ??
$context = Context::getContext();
$cart = $context->cart;
// END ??
if ($cart->id_customer == 0 || $cart->id_address_delivery == 0 || $cart->id_address_invoice == 0 || !$reembolsocargo->active) {
    Tools::redirectLink(__PS_BASE_URI__ . 'order.php?step=1');
}
$customer = new Customer((int) $cart->id_customer);
if (!Validate::isLoadedObject($customer)) {
    Tools::redirectLink(__PS_BASE_URI__ . 'order.php?step=1');
}
$currency = new Currency(Tools::getValue('currency_payement', false) ? Tools::getValue('currency_payement') : $cookie->id_currency);
$coste = (double) abs($cart->getOrderTotal(true, Cart::BOTH));
$cargo = number_format($reembolsocargo->getCargo($cart, false), 2, '.', '');
$vales = (double) abs($cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS));
$total = $coste - $vales + $cargo;
$mailVars = array('{bankwire_owner}' => Configuration::get('SEUR_TRANSCAR_OWNER'), '{bankwire_details}' => nl2br(Configuration::get('SEUR_TRANSCAR_DETAILS')), '{bankwire_address}' => nl2br(Configuration::get('SEUR_TRANSCAR_ADDRESS')));
$reembolsocargo->validateOrderFORWEBS_v4((int) $cart->id, 3, (double) $total, $reembolsocargo->displayName, NULL, $mailVars, (int) $currency->id, false, $customer->secure_key);
$order = new Order((int) $reembolsocargo->currentOrder);
Tools::redirectLink(__PS_BASE_URI__ . 'order-confirmation.php?id_cart=' . (int) $cart->id . '&id_module=' . (int) $reembolsocargo->id . '&id_order=' . (int) $reembolsocargo->currentOrder . '&key=' . urlencode($customer->secure_key));