ShoppingCart::findOrMake PHP Method

findOrMake() protected method

Helper that only allows orders to be started internally.
protected findOrMake ( ) : Order
return Order
    protected function findOrMake()
    {
        if ($this->current()) {
            return $this->current();
        }
        $this->order = Order::create();
        if (Member::config()->login_joins_cart && Member::currentUserID()) {
            $this->order->MemberID = Member::currentUserID();
        }
        $this->order->write();
        $this->order->extend('onStartOrder');
        Session::set(self::config()->cartid_session_name, $this->order->ID);
        return $this->order;
    }