public function orderConfirmationAction(Request $request, $id)
    {
        $locale = $this->getLocaleManager()->retrieveLocale($this->getUser(), $request->get('locale'));

        $this->get('translator')->setLocale($locale);

        try {
            $orderApiEntity = $this->getOrderManager()->findByIdAndLocale($id, $locale, false);
            $order = $orderApiEntity->getEntity();
        } catch (OrderNotFoundException $exc) {
            throw new OrderNotFoundException($id);
        }

        $pdf = $this->getOrderPdfManager()->createOrderConfirmation($orderApiEntity);

        // Get pdf name with function parameter isSubmitted = true.
        $pdfName = $this->getOrderPdfManager()->getPdfName($order, true);
        $responseType = $this->container->getParameter('sulu_sales_order.pdf_response_type');

        return new Response(
            $pdf,
            200,
            [
                'Content-Type' => 'application/pdf',
                'Content-Disposition' => sprintf('%s; filename="%s"', $responseType, $pdfName),
            ]
        );
    }
public function orderConfirmationAction(Request $request, $id)
    {
        $locale = $this->getLocaleManager()->retrieveLocale($this->getUser(), $request->get('locale'));

        $this->get('translator')->setLocale($locale);

        try {
            $orderApiEntity = $this->getOrderManager()->findByIdAndLocale($id, $locale, false);
            $order = $orderApiEntity->getEntity();
        } catch (OrderNotFoundException $exc) {
            throw new OrderNotFoundException($id);
        }

        $pdf = $this->getOrderPdfManager()->createOrderConfirmation($orderApiEntity);

        // Get pdf name with function parameter isSubmitted = true.
        $pdfName = $this->getOrderPdfManager()->getPdfName($order, true);
        $responseType = $this->container->getParameter('sulu_sales_order.pdf_response_type');

        return new Response(
            $pdf,
            200,
            [
                'Content-Type' => 'application/pdf',
                'Content-Disposition' => sprintf('%s; filename="%s"', $responseType, $pdfName),
            ]
        );
    }
public function orderConfirmationAction ( Request $ request , $ id ) { $ locale = $ this -> getLocaleManager ( ) -> retrieveLocale ( $ this -> getUser ( ) , $ request -> get ( 'locale' ) ) ; $ this -> get ( 'translator' ) -> setLocale ( $ locale ) ; try { $ orderApiEntity = $ this -> getOrderManager ( ) -> findByIdAndLocale ( $ id , $ locale , false ) ; $ order = $ orderApiEntity -> getEntity ( ) ; } catch ( OrderNotFoundException $ exc ) { throw new OrderNotFoundException ( $ id ) ; } $ pdf = $ this -> getOrderPdfManager ( ) -> createOrderConfirmation ( $ orderApiEntity ) ; // Get pdf name with function parameter isSubmitted = true. $ pdfName = $ this -> getOrderPdfManager ( ) -> getPdfName ( $ order , true ) ; $ responseType = $ this -> container -> getParameter ( 'sulu_sales_order.pdf_response_type' ) ; return new Response ( $ pdf , 200 , [ 'Content-Type' => 'application/pdf' , 'Content-Disposition' => sprintf ( '%s; filename="%s"' , $ responseType , $ pdfName ) , ] ) ; }
Finds an order object by a given id from the url and returns a rendered pdf in a download window.

@param Request $request
@param int $id

@throws OrderNotFoundException

@return Response
Finds an order object by a given id from the url and returns a rendered pdf in a download window .