Jump to content

Link directy to PDF invoice from html invoice


Recommended Posts

  • 4 weeks later...

Hi i need the same feature, but after user is logged in going to:
pdf-invoice.php?id_order=100015 (example)

I am getting error: Invoice not found

Its from pdf-invoice.php code:

$cookie = new Cookie('ps');
if (!$cookie->isLogged() AND !Tools::getValue('secure_key'))
   Tools::redirect('authentication.php?back=pdf-invoice.php');
if (!(int)(Configuration::get('PS_INVOICE')))
   die(Tools::displayError('Invoices are disabled in this shop.'));
if (isset($_GET['id_order']) AND Validate::isUnsignedId($_GET['id_order']))
   $order = new Order((int)($_GET['id_order']));
if (!isset($order) OR !Validate::isLoadedObject($order))
   die(Tools::displayError('Invoice not found'));
elseif ((isset($cookie->id_customer) AND $order->id_customer != $cookie->id_customer) OR (Tools::isSubmit('secure_key') AND $order->secure_key != Tools::getValue('secure_key')))
   die(Tools::displayError('Invoice not found'));
elseif (!OrderState::invoiceAvailable($order->getCurrentState()) AND !$order->invoice_number)
   die(Tools::displayError('No invoice available'));
else
   PDF::invoice($order);



So prestashop allows only to view invoices when page admin in the orders admin tab changes order status to payment accepted.

How i can edit this and others files, that user could see and get PDF invoice without changing order status? :)

Link to comment
Share on other sites

×
×
  • Create New...