public static function getCurrentBasket()
    {
        $settings = SuperCMSSession::singleton();

        try {
            $user = SCmsLoginProvider::getLoggedInUser();
            try {
                $basket = Basket::findLast(new AndGroup(
                    [
                        new Equals('UserID', $user->UniqueIdentifier),
                        new Not(new Equals('Status', self::STATUS_COMPLETED))
                    ]
                ));
            } catch (RecordNotFoundException $ex) {
                $basket = new Basket();
                $basket->UserID = $user->UniqueIdentifier;
                $basket->save();
            }

            if ($settings->basketId != $basket->UniqueIdentifier) {
                self::joinAnonymousBasketItemsToUserBasket($basket);
                self::updateSession($basket);
            }
        } catch (NotLoggedInException $ex) {
            try {
                $basket = new Basket($settings->basketId);
            } catch (RecordNotFoundException $ex) {
                $basket = new Basket();
                $basket->save();
                self::updateSession($basket);
            }
        }

        return $basket;
    }
public static function getCurrentBasket()
    {
        $settings = SuperCMSSession::singleton();

        try {
            $user = SCmsLoginProvider::getLoggedInUser();
            try {
                $basket = Basket::findLast(new AndGroup(
                    [
                        new Equals('UserID', $user->UniqueIdentifier),
                        new Not(new Equals('Status', self::STATUS_COMPLETED))
                    ]
                ));
            } catch (RecordNotFoundException $ex) {
                $basket = new Basket();
                $basket->UserID = $user->UniqueIdentifier;
                $basket->save();
            }

            if ($settings->basketId != $basket->UniqueIdentifier) {
                self::joinAnonymousBasketItemsToUserBasket($basket);
                self::updateSession($basket);
            }
        } catch (NotLoggedInException $ex) {
            try {
                $basket = new Basket($settings->basketId);
            } catch (RecordNotFoundException $ex) {
                $basket = new Basket();
                $basket->save();
                self::updateSession($basket);
            }
        }

        return $basket;
    }
public static function getCurrentBasket ( ) { $ settings = SuperCMSSession :: singleton ( ) ; try { $ user = SCmsLoginProvider :: getLoggedInUser ( ) ; try { $ basket = Basket :: findLast ( new AndGroup ( [ new Equals ( 'UserID' , $ user -> UniqueIdentifier ) , new Not ( new Equals ( 'Status' , self :: STATUS_COMPLETED ) ) ] ) ) ; } catch ( RecordNotFoundException $ ex ) { $ basket = new Basket ( ) ; $ basket -> UserID = $ user -> UniqueIdentifier ; $ basket -> save ( ) ; } if ( $ settings -> basketId != $ basket -> UniqueIdentifier ) { self :: joinAnonymousBasketItemsToUserBasket ( $ basket ) ; self :: updateSession ( $ basket ) ; } } catch ( NotLoggedInException $ ex ) { try { $ basket = new Basket ( $ settings -> basketId ) ; } catch ( RecordNotFoundException $ ex ) { $ basket = new Basket ( ) ; $ basket -> save ( ) ; self :: updateSession ( $ basket ) ; } } return $ basket ; }
Creates an instance of the basket, and reloads the object.
@return Basket
Creates an instance of the basket and reloads the object .