Wandry Posted July 3, 2009 Share Posted July 3, 2009 [noob inside]Bonjour,j'ai essayé de créer un module pour éditer automatiquement les étiquettes d'envoi depuis le panneau admin.J'utilise donc la librairie fpdf et je récupère les coordonées du client. Le script pour l'édition fonctione mais lorsque j'ai essayé de le metttre sous la forme d'un module prestashop ça plante :je place mond dossier dans la liste des modules mais il ne s'affiche pas comme module disponible.J'en déduit donc qu'il y a une erreur quelque part mais la je suis en panne.quelqu'un pour m'aider?Voici mon code : un premier script PrintLabel.php décrit le module qui appelle l'autre labelfpdf.php crée le pdf : > <?php class PrintLabel extends Module { function __construct() { $this->name = 'printlabel'; $this->version = '1.0'; $this->tab = 'AdminOrders'; $this->page = basename(__FILE__, '.php'); $this->displayName = $this->('Delivery Label'); $this->description = $this->('Add a block to print delivery label '); parent::__construct(); } function install() { if (parent::install()==false) return false; return true; } public function getContent() { $this->displayLabelDescription(); return $this->_html; } public function displayLabelDescription() { $this->_html .= ' </pre> <table border="0"> '.$this->('Allow to print Delivery Label').' '; } } function hookAdminOrder($params) { $display = ' '.$this->('Create delivery label').' name.'/labelfpdf.php'.$params["id_order"].' '; return $display; } } ?> </t labelfpdf.php: <?php require('fpdf.php'); / include('../../config/config.inc.php'); if(intval($_GET["id_order"]) > 0) { $order = new Order(intval($_GET["id_order"])); $customer = new Customer($order->id_customer); $ad = new Address(intval($order->id_address_delivery)); //champs adresse à récupérer à l'intégration $entreprise=$ad->company; $prenom=$ad->lastname; $nom=$ad->firstname; $champadresse1=$ad->address1; $champadresse2=$ad->address2; $codepostal=$ad->postcode; $ville=$ad->city; $pays=$ad->id_country; $pdf=new FPDF('L', 'mm', array(36,89)); $pdf->AddPage(); $pdf->SetDrawColor(255); $pdf->SetAutoPageBreak(false); $pdf->SetFont('Helvetica','',12); $pdf->SetMargins(10,0,0); $pdf->SetXY(10,2); $pdf ->Write(5,"$entreprise \n$prenom $nom \n$champadresse1 \n$champadresse2 \n$codepostal $ville \n$pays"); $pdf->Output(); ?> Link to comment Share on other sites More sharing options...
Wandry Posted July 7, 2009 Author Share Posted July 7, 2009 sujet resolule dossier et le script principal doivent avoir le même nom. Link to comment Share on other sites More sharing options...
Patric Posted July 7, 2009 Share Posted July 7, 2009 Je mets donc le post en [Résolu].Merci de penser à le faire la prochaine fois en modifiant le premier post du topic. 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