Jump to content

PDF retour produit non généré (page blanche)


Recommended Posts

Bonjour je rencontre une problématique avec la génération du PDF de retour produit dans prestashop.

 

Une fois le retour accepté, lorsque je clique sur la génération du bon de retour, la page affichée est blanche.

 

Les paramètres d'appels du controller semblent OK et dans le fichier du controller je ne vois rien de particulier.

 

controller=pdf-order-return&id_order_return=3

 

Quelqu'un à déjà rencontré cette problématique ?

 

 

Le contenu du fichier reste celui par défaut :

 

<?php
/*
* 2007-2016 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <[email protected]>
*  @copyright  2007-2016 PrestaShop SA
*  @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/

class PdfOrderReturnControllerCore extends FrontController
{
    public $php_self = 'pdf-order-return';
    protected $display_header = false;
    protected $display_footer = false;

    public function postProcess()
    {
        $from_admin = (Tools::getValue('adtoken') == Tools::getAdminToken('AdminReturn'.(int)Tab::getIdFromClassName('AdminReturn').(int)Tools::getValue('id_employee')));

        if (!$from_admin && !$this->context->customer->isLogged()) {
            Tools::redirect('index.php?controller=authentication&back=order-follow');
        }

        if (Tools::getValue('id_order_return') && Validate::isUnsignedId(Tools::getValue('id_order_return'))) {
            $this->orderReturn = new OrderReturn(Tools::getValue('id_order_return'));
        }

        if (!isset($this->orderReturn) || !Validate::isLoadedObject($this->orderReturn)) {
            die(Tools::displayError('Order return not found.'));
        } elseif (!$from_admin && $this->orderReturn->id_customer != $this->context->customer->id) {
            die(Tools::displayError('Order return not found.'));
        } elseif ($this->orderReturn->state < 2) {
            die(Tools::displayError('Order return not confirmed.'));
        }
    }

    public function display()
    {
        $pdf = new PDF($this->orderReturn, PDF::TEMPLATE_ORDER_RETURN, $this->context->smarty);
        $pdf->render();
    }
}

 

 

Merci !

Bonne journée

Link to comment
Share on other sites

Bon j'ai passé prestashop en mode debug et c'est ce message là qui ressort :

 

Fatal error: Uncaught TypeError: Argument 1 passed to HTMLTemplateInvoiceCore::__construct() must be an instance of OrderInvoice, instance of OrderReturn given, called in /homepages/42/d636835566/htdocs/NewFolder/classes/pdf/PDF.php on line 127 and defined in /homepages/42/d636835566/htdocs/NewFolder/classes/pdf/HTMLTemplateInvoice.php:41 Stack trace: #0 /homepages/42/d636835566/htdocs/NewFolder/classes/pdf/PDF.php(127): HTMLTemplateInvoiceCore->__construct(Object(OrderReturn), Object(SmartyCustom), false) #1 /homepages/42/d636835566/htdocs/NewFolder/classes/pdf/PDF.php(79): PDFCore->getTemplateObject(Object(OrderReturn)) #2 /homepages/42/d636835566/htdocs/NewFolder/controllers/front/PdfOrderReturnController.php(57): PDFCore->render() #3 /homepages/42/d636835566/htdocs/NewFolder/classes/controller/Controller.php(209): PdfOrderReturnControllerCore->display() #4 /homepages/42/d636835566/htdocs/NewFolder/classes/Dispatcher.php(367): ControllerCore->run() #5 /homepages/42/d636835566/htdocs/NewFolder/index.php(28): DispatcherC in /homepages/42/d636835566/htdocs/NewFolder/classes/pdf/HTMLTemplateInvoice.php on line 41

 

ça vous dit quelque chose ?

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

Solution :

 

Manque en réalité la classe de pagination donc se placer dans class/PDF/HTMLTemplateOrderReturn.php et insérer à la fin du document.

 

public function getPagination() { return $this->smarty->fetch($this->getTemplate('pagination')); }

 

Vider les caches, ctrl+f5 etc et test et OK ;)

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