mfrederic4 Posted May 21, 2013 Share Posted May 21, 2013 (edited) Bonjour, Mes clients ne peuvent pas imprimer leur factures. J'ai le message suivant: Parse error: syntax error, unexpected T_PROTECTED in /home/www/monsite.com/controllers/front/PdfInvoiceController.php on line 42 Si quelqu'un connaissant le php peut m'aider à corriger le problème. Merci de votre aide. Fred. Je suis sous prestashop 1.5.4.1. Edited May 22, 2013 by mfrederic4 (see edit history) Link to comment Share on other sites More sharing options...
2FR3 Posted May 21, 2013 Share Posted May 21, 2013 Peut tu nous donner le contenu de cette ligne avec +10/-10 (ligne 32 a 52) stp ? Link to comment Share on other sites More sharing options...
mfrederic4 Posted May 21, 2013 Author Share Posted May 21, 2013 (edited) Oui bien sur, voici le fichier complet: (ligne 27)class PdfInvoiceControllerCore extends FrontController { public static function displayCarrier($id, $orderlg) { if ($id != null){ $carrier="NA"; return $carrier; } else{ $carrier = new Carrier($id, $orderlg); return $carrier; } } } { (ligne 42)protected $display_header = false; protected $display_footer = false; public $content_only = true; protected $template; public $filename; public function postProcess() { if (!$this->context->customer->isLogged() && !Tools::getValue('secure_key')) Tools::redirect('index.php?controller=authentication&back=pdf-invoice'); if (!(int)Configuration::get('PS_INVOICE')) die(Tools::displayError('Invoices are disabled in this shop.')); $id_order = (int)Tools::getValue('id_order'); if (Validate::isUnsignedId($id_order)) $order = new Order((int)$id_order); if (!isset($order) || !Validate::isLoadedObject($order)) die(Tools::displayError('The invoice was not found.')); if ((isset($this->context->customer->id) && $order->id_customer != $this->context->customer->id) || (Tools::isSubmit('secure_key') && $order->secure_key != Tools::getValue('secure_key'))) die(Tools::displayError('The invoice was not found.')); if (!OrderState::invoiceAvailable($order->getCurrentState()) && !$order->invoice_number) die(Tools::displayError('No invoice is available.')); $this->order = $order; } public function display() { $order_invoice_list = $this->order->getInvoicesCollection(); Hook::exec('actionPDFInvoiceRender', array('order_invoice_list' => $order_invoice_list)); $pdf = new PDF($order_invoice_list, PDF::TEMPLATE_INVOICE, $this->context->smarty, $this->context->language->id); $pdf->render(); } /** * Returns the invoice template associated to the country iso_code * @param string $iso_user */ public function getTemplate($iso_country) { $template = _PS_THEME_PDF_DIR_.'/invoice.tpl'; $iso_template = _PS_THEME_PDF_DIR_.'/invoice.'.$iso_country.'.tpl'; if (file_exists($iso_template)) $template = $iso_template; return $template; } } Merci Fred Edited May 21, 2013 by mfrederic4 (see edit history) Link to comment Share on other sites More sharing options...
Vinum Posted May 22, 2013 Share Posted May 22, 2013 (edited) Bonjour, Bizarre ton fichier. Ce n'est pas le fichier original natif de prestashop. Il a été modifié vraisemblablement pour un besoin propre. Tes définitions de variables protected devraient se trouver en début de définition de la classe. Donc comme cela : class PdfInvoiceControllerCore extends FrontController { protected $display_header = false; protected $display_footer = false; public $content_only = true; protected $template; public $filename; De plus, il y'a des { et } qui n'ont rien à faire là. Ta classe devrait plutôt ressembler à ça : class PdfInvoiceControllerCore extends FrontController { protected $display_header = false; protected $display_footer = false; public $content_only = true; protected $template; public $filename; public static function displayCarrier($id, $orderlg) { if ($id != null){ $carrier="NA"; return $carrier; } else{ $carrier = new Carrier($id, $orderlg); return $carrier; } } public function postProcess() { if (!$this->context->customer->isLogged() && !Tools::getValue('secure_key')) Tools::redirect('index.php?controller=authentication&back=pdf-invoice'); if (!(int)Configuration::get('PS_INVOICE')) die(Tools::displayError('Invoices are disabled in this shop.')); $id_order = (int)Tools::getValue('id_order'); if (Validate::isUnsignedId($id_order)) $order = new Order((int)$id_order); if (!isset($order) || !Validate::isLoadedObject($order)) die(Tools::displayError('The invoice was not found.')); if ((isset($this->context->customer->id) && $order->id_customer != $this->context->customer->id) || (Tools::isSubmit('secure_key') && $order->secure_key != Tools::getValue('secure_key'))) die(Tools::displayError('The invoice was not found.')); if (!OrderState::invoiceAvailable($order->getCurrentState()) && !$order->invoice_number) die(Tools::displayError('No invoice is available.')); $this->order = $order; } public function display() { $order_invoice_list = $this->order->getInvoicesCollection(); Hook::exec('actionPDFInvoiceRender', array('order_invoice_list' => $order_invoice_list)); $pdf = new PDF($order_invoice_list, PDF::TEMPLATE_INVOICE, $this->context->smarty, $this->context->language->id); $pdf->render(); } /** * Returns the invoice template associated to the country iso_code * @param string $iso_user */ public function getTemplate($iso_country) { $template = _PS_THEME_PDF_DIR_.'/invoice.tpl'; $iso_template = _PS_THEME_PDF_DIR_.'/invoice.'.$iso_country.'.tpl'; if (file_exists($iso_template)) $template = $iso_template; return $template; } } Edited May 22, 2013 by Vinum (see edit history) Link to comment Share on other sites More sharing options...
mfrederic4 Posted May 22, 2013 Author Share Posted May 22, 2013 Effectivement il y a un problème avec ce fichier!! Je l'ai remplacé par le fichier d’origine natif et cela fonctionne. Merci de votre aide Fred Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now