public function CommerceCartProviderSession::cartSave in Commerce Core 7
Saves an order ID.
Parameters
$order_id: The order ID to save to the array.
$completed: Boolean indicating whether or not the operation should save to the completed orders array instead of the active cart orders array.
Overrides CommerceCartProviderInterface::cartSave
File
- modules/
cart/ plugins/ cart_provider/ CommerceCartProviderSession.class.php, line 54
Class
- CommerceCartProviderSession
- Defines a session array based cart provider.
Code
public function cartSave($order_id, $completed = FALSE) {
$key = $completed ? self::COMPLETED : self::CART;
if (empty($_SESSION[$key])) {
$_SESSION[$key] = array(
$order_id,
);
}
elseif (!in_array($order_id, $_SESSION[$key])) {
$_SESSION[$key][] = $order_id;
}
}