src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php
public static function &GetLastCreatedOrder($bResetValue = false)
    {
        $oOrder = null;
        if (array_key_exists(self::SESSION_KEY_LAST_CREATED_ORDER_ID, $_SESSION)) {
            $oOrder = TdbShopOrder::GetNewInstance();
            /** @var $oOrder TdbShopOrder */
            if ($oOrder->Load($_SESSION[self::SESSION_KEY_LAST_CREATED_ORDER_ID])) {
                // now we want to make sure that the current user is the owner of that order. this is
                // the case if: the user is logged in and the user id in the order matches, or the user is
                // not logged in and the order has no user id
                $oUser = TdbDataExtranetUser::GetInstance();
                $isOwner = ($oUser->IsLoggedIn() && $oOrder->fieldDataExtranetUserId == $oUser->id);
                $isOwner = ($isOwner || (!$oUser->IsLoggedIn() && $oOrder->fieldDataExtranetUserId < 1));
                if (!$isOwner) {
                    $oOrder = null;
                }
            } else {
                $oOrder = null;
            }
            if ($bResetValue) {
                unset($_SESSION[self::SESSION_KEY_LAST_CREATED_ORDER_ID]);
            }
        }

        return $oOrder;
    }
public static function &GetLastCreatedOrder($bResetValue = false)
    {
        $oOrder = null;
        if (array_key_exists(self::SESSION_KEY_LAST_CREATED_ORDER_ID, $_SESSION)) {
            $oOrder = TdbShopOrder::GetNewInstance();
            /** @var $oOrder TdbShopOrder */
            if ($oOrder->Load($_SESSION[self::SESSION_KEY_LAST_CREATED_ORDER_ID])) {
                // now we want to make sure that the current user is the owner of that order. this is
                // the case if: the user is logged in and the user id in the order matches, or the user is
                // not logged in and the order has no user id
                $oUser = TdbDataExtranetUser::GetInstance();
                $isOwner = ($oUser->IsLoggedIn() && $oOrder->fieldDataExtranetUserId == $oUser->id);
                $isOwner = ($isOwner || (!$oUser->IsLoggedIn() && $oOrder->fieldDataExtranetUserId < 1));
                if (!$isOwner) {
                    $oOrder = null;
                }
            } else {
                $oOrder = null;
            }
            if ($bResetValue) {
                unset($_SESSION[self::SESSION_KEY_LAST_CREATED_ORDER_ID]);
            }
        }

        return $oOrder;
    }
public static function & GetLastCreatedOrder ( $ bResetValue = false ) { $ oOrder = null ; if ( array_key_exists ( self :: SESSION_KEY_LAST_CREATED_ORDER_ID , $ _SESSION ) ) { $ oOrder = TdbShopOrder :: GetNewInstance ( ) ; /** @var $oOrder TdbShopOrder */ if ( $ oOrder -> Load ( $ _SESSION [ self :: SESSION_KEY_LAST_CREATED_ORDER_ID ] ) ) { // now we want to make sure that the current user is the owner of that order. this is // the case if: the user is logged in and the user id in the order matches, or the user is // not logged in and the order has no user id $ oUser = TdbDataExtranetUser :: GetInstance ( ) ; $ isOwner = ( $ oUser -> IsLoggedIn ( ) && $ oOrder -> fieldDataExtranetUserId == $ oUser -> id ) ; $ isOwner = ( $ isOwner || ( ! $ oUser -> IsLoggedIn ( ) && $ oOrder -> fieldDataExtranetUserId < 1 ) ) ; if ( ! $ isOwner ) { $ oOrder = null ; } } else { $ oOrder = null ; } if ( $ bResetValue ) { unset ( $ _SESSION [ self :: SESSION_KEY_LAST_CREATED_ORDER_ID ] ) ; } } return $ oOrder ; }
returns the order object created last within the current session of the user.

@param bool $bResetValue - set to true if you want to reset the session item

@return TdbShopOrder
returns the order object created last within the current session of the user .