3DSecure 重定向后 Prestashop 1.6 购物车恢复
Prestashop 1.6 Cart recovery after 3DSecure redirect
我正在构建一个基于 Authorize.net (aim) 模块的支付网关模块。问题是在 3DSecure 验证后,它会重定向回网站,但我认为购物车不在上下文中。
在重定向之前,我将购物车 ID 保存到会话中。
它抛出以下错误:
"Cart cannot be loaded or an order has already been placed using this cart"
这是由以下因素触发的:
if (Validate::isLoadedObject($this->context->cart) && $this->context->cart->OrderExists() == false)
在 classes/PaymentModule 的第 188 行。php
我怎样才能load/reload购物车?
谢谢
雅克
在许多支付模块中,Prestashop 在银行重定向之前创建订单,但缺少支付状态,并等待银行确认更新订单。
如果您仍想重新生成购物车,可以使用 ParentOrderController 中的 submitReorder 功能来实现。
$oldCart = new Cart(Order::getCartIdStatic($id_order, $this->context->customer->id));
$duplication = $oldCart->duplicate();
if (!$duplication || !Validate::isLoadedObject($duplication['cart'])) {
$this->errors[] = Tools::displayError('Sorry. We cannot renew your order.');
} elseif (!$duplication['success']) {
$this->errors[] = Tools::displayError('Some items are no longer available, and we are unable to renew your order.');
} else {
$this->context->cookie->id_cart = $duplication['cart']->id;
$context = $this->context;
$context->cart = $duplication['cart'];
CartRule::autoAddToCart($context);
$this->context->cookie->write();
if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1) {
Tools::redirect('index.php?controller=order-opc');
}
Tools::redirect('index.php?controller=order');
}
我正在构建一个基于 Authorize.net (aim) 模块的支付网关模块。问题是在 3DSecure 验证后,它会重定向回网站,但我认为购物车不在上下文中。
在重定向之前,我将购物车 ID 保存到会话中。
它抛出以下错误:
"Cart cannot be loaded or an order has already been placed using this cart"
这是由以下因素触发的:
if (Validate::isLoadedObject($this->context->cart) && $this->context->cart->OrderExists() == false)
在 classes/PaymentModule 的第 188 行。php
我怎样才能load/reload购物车?
谢谢
雅克
在许多支付模块中,Prestashop 在银行重定向之前创建订单,但缺少支付状态,并等待银行确认更新订单。
如果您仍想重新生成购物车,可以使用 ParentOrderController 中的 submitReorder 功能来实现。
$oldCart = new Cart(Order::getCartIdStatic($id_order, $this->context->customer->id));
$duplication = $oldCart->duplicate();
if (!$duplication || !Validate::isLoadedObject($duplication['cart'])) {
$this->errors[] = Tools::displayError('Sorry. We cannot renew your order.');
} elseif (!$duplication['success']) {
$this->errors[] = Tools::displayError('Some items are no longer available, and we are unable to renew your order.');
} else {
$this->context->cookie->id_cart = $duplication['cart']->id;
$context = $this->context;
$context->cart = $duplication['cart'];
CartRule::autoAddToCart($context);
$this->context->cookie->write();
if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1) {
Tools::redirect('index.php?controller=order-opc');
}
Tools::redirect('index.php?controller=order');
}