Jump to content

PS 1.7.5.0 not generating invoices using Orders > Invoices


ivanpav

Recommended Posts

Hello.

I have one problem.

If I go to Order detail and generate invoice, all is ok, it is downloadable. But from Orders > Invoices .. only the spin is running and nothing happens, no file download offer.  It only refreshes the backoffice and nothing happens. Can you help me please? I also tried debug mode and no error messages.

Thak you very much.

Edited by ivanpav (see edit history)
Link to comment
Share on other sites

  • 1 year later...

Did you solve it somehow?

  • Exactly the same - the invoices are there to be downloaded via order, but not via Export
  • But "Generating PDF" click - worksbut nothing happens (page with invoice export just refreshes)
  • Enabling DebugMode broke my admin - like 20 errors dooh
  • PrestaShop version: 1.7.6.4

I could download the invoice one by one but I still would like to have it solved

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...

Have any of you found out where the problem is? I have discovered it might be a hosting issue, because when I moved the site to another host, it started working. But I have no idea whats wrong with the old hosting, because there are no errors, it just does not work.

Link to comment
Share on other sites

On 1/14/2021 at 12:25 PM, ovlcek said:

Have any of you found out where the problem is? I have discovered it might be a hosting issue, because when I moved the site to another host, it started working. But I have no idea whats wrong with the old hosting, because there are no errors, it just does not work.

hm,
i tried update for 1.7.7 but generate invoices dont work

Link to comment
Share on other sites

  • 4 months later...
  • 1 month later...
6 hours ago, ovlcek said:

@smrkiki1 @beshop 

 

Try this link if it does work:

https://www.YOURDOMAIN.COM/ADMIN/index.php?controller=AdminPdf&date_from=2021-01-01&date_to=2021-01-21&submitAction=generateInvoicesPDF&token=TOKEN

if you login to your prestashop administration, you can get token from URL. just replace TOKEN with the actual token.

YES this work fine. 

 

but why doesnt work if i click to button, ?

Link to comment
Share on other sites

On 6/29/2021 at 12:07 AM, ovlcek said:

@smrkiki1 @beshop 

 

Try this link if it does work:

https://www.YOURDOMAIN.COM/ADMIN/index.php?controller=AdminPdf&date_from=2021-01-01&date_to=2021-01-21&submitAction=generateInvoicesPDF&token=TOKEN

if you login to your prestashop administration, you can get token from URL. just replace TOKEN with the actual token.

hi,
when i replace YOURDOMAIN.COM/ADMIN and TOKEN (token from orders > invoices) every time prestashop redirect to admin login page and i dont know what i do wrong

 

Link to comment
Share on other sites

  • 2 months later...

Has anyone found an answer to this problem? I'm experiencing the same on PS 1.7.6.1. The POST request is made correctly, the request headers indicate that a file transfer is to be initiated with the correct invoice filename, but it returns a 302 response code and redirects to the invoices screen without downloading anything...

image.png.0ca48186ec780242d2fb47bb28b46b00.png

Link to comment
Share on other sites

On 9/18/2021 at 8:46 PM, smrkiki1 said:

Yes, it does, but that's not a solution, that's a cumbersome workaround at best. Regular users will never prefer that method.

Link to comment
Share on other sites

  • 6 months later...
On 9/20/2021 at 8:57 AM, Les Vikings said:

Yes, it does, but that's not a solution, that's a cumbersome workaround at best. Regular users will never prefer that method.

I have same problem on 1.7.8.5, link is working, but button not. However generate of order slips working fine via button.

Edited by rado111 (see edit history)
Link to comment
Share on other sites

  • 7 months later...

I've managed to fix this. I believe it has to do something with hosting configuration, because Invoice PDF generating work in Prestashop demo.

You need FTP access to edit this file:

/src/PrestaShopBundle/Controller/Admin/Sell/Order/InvoicesController.php

Find this method

    public function generatePdfByDateAction(Request $request)
    {
        $formHandler = $this->get('prestashop.admin.order.invoices.by_date.form_handler');
        $this->processForm($formHandler, $request);

        return $this->redirectToRoute('admin_order_invoices');
    }

and replace it with this method (working on PS 1.7.8.7)

    public function generatePdfByDateAction(Request $request)
    {
        $formHandler = $this->get('prestashop.admin.order.invoices.by_date.form_handler');
        $form = $formHandler->getForm();
        $form->handleRequest($request);
        if ($form->isSubmitted() && $form->isValid()) {
            $errors = $formHandler->save($form->getData());
            if (empty($errors)) {
                $by_date = $form->getData();

                return $this->redirect(
                    $this->get('prestashop.adapter.legacy.context')->getAdminLink(
                        'AdminPdf',
                        true,
                        [
                            'date_from' => $by_date['date_from'],
                            'date_to' => $by_date['date_to'],
                            'submitAction' => 'generateInvoicesPDF',
                        ]
                    )
                );
            }
        }

        if (!empty($errors)) {
            $this->flashErrors($errors);
        }

        return $this->redirectToRoute('admin_order_invoices');
    }

if it does not work for you, try to replace it with this one (working on PS 1.7.6.7)

    public function generatePdfByDateAction(Request $request)
    {
        $formHandler = $this->get('prestashop.admin.order.invoices.by_date.form_handler');
        $form = $formHandler->getForm();
        $form->handleRequest($request);
        if ($form->isSubmitted() && $form->isValid()) {
            $errors = $formHandler->save($form->getData());
            if (empty($errors)) {
                $by_date = $form->get('generate_by_date')->getData();

                return $this->redirect(
                    $this->get('prestashop.adapter.legacy.context')->getAdminLink(
                        'AdminPdf',
                        true,
                        [
                            'date_from' => $by_date['date_from'],
                            'date_to' => $by_date['date_to'],
                            'submitAction' => 'generateInvoicesPDF',
                        ]
                    )
                );
            }
        }
        
        if (!empty($errors)) {
            $this->flashErrors($errors);
        }

        return $this->redirectToRoute('admin_order_invoices');
    }

Bear in mind these files will be overriden with every Prestashop update. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...