src/Frontend/Modules/Commerce/Actions/Cart.php
/**
     * Display the request quote page.
     *
     * @throws RedirectException
     */
Display the request quote page.
Display the request quote page .
private function requestQuote(): void
    {
        $this->loadTemplate('Commerce/Layout/Templates/RequestQuote.html.twig');
        $form = $this->createForm(
            QuoteType::class,
            new QuoteDataTransferObject()
        );
        $form->handleRequest($this->getRequest());
        if (!$form->isSubmitted() || !$form->isValid()) {
            $this->breadcrumb->addElement(
                ucfirst(Language::lbl('RequestQuote')),
                Navigation::getUrlForBlock($this->getModule(), 'Cart') . '/' . Language::lbl('RequestQuoteUrl')
            );
            if ($this->getRequest()->get('submitted')) {
                $this->template->assign('quoteSubmitted', true);
                $this->header->setPageTitle(ucfirst(Language::lbl('ThankYouForYouQuote')));
                $this->loadTemplate('Commerce/Layout/Templates/QuoteSuccess.html.twig');
                $deleteCart = new DeleteCart($this->cart);
                $this->get('command_bus')->handle($deleteCart);
            } else {
                $this->header->setPageTitle(ucfirst(Language::lbl('RequestQuote')));
                $this->template->assign('form', $form->createView());
                $this->template->assign('cart', $this->cart);
                $this->template->assign('quoteSubmitted', false);
            }
            return;
        }
        $this->get('event_dispatcher')->dispatch(
            QuoteCreated::EVENT_NAME,
            new QuoteCreated($form->getData(), $this->cart)
        );
        $this->redirect(
            Navigation::getUrlForBlock($this->getModule(), 'Cart') . '/' . Language::lbl('RequestQuoteUrl') . '?submitted=1'
        );
    }
private function requestQuote ( ) : void { $ this -> loadTemplate ( 'Commerce/Layout/Templates/RequestQuote.html.twig' ) ; $ form = $ this -> createForm ( QuoteType :: class , new QuoteDataTransferObject ( ) ) ; $ form -> handleRequest ( $ this -> getRequest ( ) ) ; if ( ! $ form -> isSubmitted ( ) || ! $ form -> isValid ( ) ) { $ this -> breadcrumb -> addElement ( ucfirst ( Language :: lbl ( 'RequestQuote' ) ) , Navigation :: getUrlForBlock ( $ this -> getModule ( ) , 'Cart' ) . '/' . Language :: lbl ( 'RequestQuoteUrl' ) ) ; if ( $ this -> getRequest ( ) -> get ( 'submitted' ) ) { $ this -> template -> assign ( 'quoteSubmitted' , true ) ; $ this -> header -> setPageTitle ( ucfirst ( Language :: lbl ( 'ThankYouForYouQuote' ) ) ) ; $ this -> loadTemplate ( 'Commerce/Layout/Templates/QuoteSuccess.html.twig' ) ; $ deleteCart = new DeleteCart ( $ this -> cart ) ; $ this -> get ( 'command_bus' ) -> handle ( $ deleteCart ) ; } else { $ this -> header -> setPageTitle ( ucfirst ( Language :: lbl ( 'RequestQuote' ) ) ) ; $ this -> template -> assign ( 'form' , $ form -> createView ( ) ) ; $ this -> template -> assign ( 'cart' , $ this -> cart ) ; $ this -> template -> assign ( 'quoteSubmitted' , false ) ; } return ; } $ this -> get ( 'event_dispatcher' ) -> dispatch ( QuoteCreated :: EVENT_NAME , new QuoteCreated ( $ form -> getData ( ) , $ this -> cart ) ) ; $ this -> redirect ( Navigation :: getUrlForBlock ( $ this -> getModule ( ) , 'Cart' ) . '/' . Language :: lbl ( 'RequestQuoteUrl' ) . '?submitted=1' ) ; }
Display the request quote page.
Display the request quote page .
// Load the form // Assign current request to form // Check if there are any errors in our submit