get order id when transaction ok
This commit is contained in:
parent
b0bb2abcda
commit
67736843ff
@ -19,6 +19,8 @@ class Cart extends BaseCart
|
||||
{
|
||||
use DelayTrait;
|
||||
|
||||
public static $_shouldRenderOrderId = false;
|
||||
|
||||
public function getMondialRelayAddress() {
|
||||
global $cookie;
|
||||
|
||||
@ -104,6 +106,22 @@ class Cart extends BaseCart
|
||||
), 0)->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the order id of the cart
|
||||
*
|
||||
* @return integer $id_order associated cart order id
|
||||
*/
|
||||
public function getOrderId() {
|
||||
if (static::$_shouldRenderOrderId) {
|
||||
return (int)\Db::getInstance()->getValue('
|
||||
SELECT `id_order ` FROM `'._DB_PREFIX_.'orders`
|
||||
WHERE `id_cart` = '.(int)$this->id.'
|
||||
');
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@ -129,6 +147,7 @@ class Cart extends BaseCart
|
||||
'delay_name' => empty($delays) ? '' : $this->getDelayName($delays[0]),
|
||||
'economy' => ApiTools::displayPrice($economy),
|
||||
'address_relay' => $this->getAddressRelay(),
|
||||
'id_order' => $this->getOrderId(),
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -121,6 +121,7 @@ class PayboxController extends ApiBaseController {
|
||||
$paybox->validateOrder((int)$cart->id, _PS_OS_PAYMENT_, ((int)$input_data['MONTANT']) / 100, $paybox->displayName, $info, array(), NULL, false, $user->secure_key, $data);
|
||||
$paybox->saveInformationPaiement($data);
|
||||
}
|
||||
$cart->_shouldRenderOrderId = true;
|
||||
return $cart;
|
||||
}
|
||||
|
||||
|
@ -102,6 +102,7 @@ class PaypalController extends ApiBaseController {
|
||||
if ($result !== true) {
|
||||
throw new HttpBadRequestException('Une erreur est survenue lors de la validation de votre commmande. Veuillez réesayer ultérieurement.');
|
||||
}
|
||||
$cart->_shouldRenderOrderId = true;
|
||||
return $cart;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user