Jump to content

[SOLVED]Invoice PDF redirect to The page you are looking for was not found.


Woden

Recommended Posts

The invoice from the admin control works and generates a PDF while if I go to the history details of the customer page (not guest) and click on invoice pdf or details it ends up in "The page you are looking for was not found."??

how can be solved?

 

using Prestashop 1.7.8.5

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

It looks like from the admin mode it is linking to a token to download the PDF but from the customer page instead not.

For example from the client control panel --- > index.php?controller=pdf-invoice&id_order=6

---> page not found (404)

From the admin control panel --- > admin/index.php/sell/orders/6/generate-invoice-pdf?_token=Gew6KVOufaUfoms9ig23IMj4MLo2MH_23jsQQG35EcA

---> download correctly the invoice .

Same as per oder details on the customer history order page... (not found)

For me looks like there is something missing inside the page code of the client side like a tokenizer to access the PDF itself? not sure about it and where can I modify eventually the code

Link to comment
Share on other sites

This for clicking on PDF and Details respectively .

I am using the above version of PShop with PHP74.

I have also tested PHP requirements with phppsinfo.ph and are all green and satisfied ..

Link to comment
Share on other sites

It was not a Prestashop error. It was a misconfiguration inside the default NGINX config as written on prestashop website.

Changing the rewrites as below solved and now is working just fine!

    # [EDIT] If you are using multiple languages.
    # rewrite ^/fr$ /fr/ redirect;
    # rewrite ^/fr/(.*) /$1;

       rewrite ^/([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$1$2$3.jpg last;
       rewrite ^/([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$1$2$3$4.jpg last;
       rewrite ^/([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$1$2$3$4$5.jpg last;
       rewrite ^/([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg last;
       rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg last;
       rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg last;
       rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg last;
       rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg la>
       rewrite ^/c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ /img/c/$1$2$3.jpg last;
       rewrite ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ /img/c/$1$2.jpg last;
       rewrite ^/[a-zA-Z][a-zA-Z]/index.php(.*)$ /index.php$1;

  # Force pdf files to be downloaded
    location ~* \.pdf$ {
    add_header Content-Disposition Attachment;
    add_header X-Content-Type-Options nosniff;
    }
 

   
 

Link to comment
Share on other sites

  • Woden changed the title to [SOLVED]Invoice PDF redirect to The page you are looking for was not found.

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...