akhawat Posted May 23, 2015 Share Posted May 23, 2015 Bonjour lorsque je passe une commande au statut "preparation en cours" le bon de livraison est bien créé mais impossible de le visualiser ou de l'imprimer. le seul moyen de le visualiser c'est de cocher la case "Autoriser les clients à télécharger et lire la version PDF de la facture" ce qui fait qu'une facture est automatiquement créé avec la mention "no payement" est ce normal d'être obligé de créé une facture pour visualiser le bon de livraison. y'a t'il une solution pour avoir le bon de livraison sans créé de facture ? je suis en 1.5.6.1 cdlt Link to comment Share on other sites More sharing options...
rom1z Posted August 30, 2015 Share Posted August 30, 2015 Bonjour, je recherche à faire la même chose, afficher le BL avant de générer la facture. Avez-vous trouvé? Link to comment Share on other sites More sharing options...
akhawat Posted August 31, 2015 Author Share Posted August 31, 2015 Bonjour non malheureusement je n'ais pas pas encore trouvé de solution et ca n'a l'air d'interesser personne ! Link to comment Share on other sites More sharing options...
AmigaINC Posted February 19, 2016 Share Posted February 19, 2016 (edited) Bonjour à tous, j'ai rencontré le même problème sur un PS 1.6.0.11, et voici les modifications apportées pour avoir un BL sans facture (car je supprime les infos facture par script) : Fichier controllers/admin/AdminPdfController.php : public function generateDeliverySlipPDFByIdOrder($id_order) { $order = new Order((int)$id_order); if (!Validate::isLoadedObject($order)) throw new PrestaShopException('Can\'t load Order object'); //$order_invoice_collection = $order->getInvoicesCollection(); $this->generatePDF($order, PDF::TEMPLATE_DELIVERY_SLIP); } Fichier classes/pdf/HTMLTemplateDeliverySlip.php public function __construct(Order $order, $smarty) { //$this->order_invoice = $order_invoice; $this->order = $order; //new Order($this->order_invoice->id_order); $this->smarty = $smarty; // header informations $this->date = Tools::displayDate($this->order->invoice_date); $prefix = Configuration::get('PS_DELIVERY_PREFIX', Context::getContext()->language->id); $this->title = sprintf(HTMLTemplateDeliverySlip::l('Delivery #%1$s%2$06d'), $prefix, $this->order->delivery_number); // footer informations $this->shop = new Shop((int)$this->order->id_shop); } /** * Returns the template's HTML content * @return string HTML content */ public function getContent() { $delivery_address = new Address((int)$this->order->id_address_delivery); $formatted_delivery_address = AddressFormat::generateAddress($delivery_address, array(), '<br />', ' '); $formatted_invoice_address = ''; if ($this->order->id_address_delivery != $this->order->id_address_invoice) { $invoice_address = new Address((int)$this->order->id_address_invoice); $formatted_invoice_address = AddressFormat::generateAddress($invoice_address, array(), '<br />', ' '); } $carrier = new Carrier($this->order->id_carrier); $carrier->name = ($carrier->name == '0' ? Configuration::get('PS_SHOP_NAME') : $carrier->name); $order_details = $this->order->getProducts(); if (Configuration::get('PS_PDF_IMG_DELIVERY')) foreach ($order_details as &$order_detail) { if ($order_detail['image'] != null) { $name = 'product_mini_'.(int)$order_detail['product_id'].(isset($order_detail['product_attribute_id']) ? '_'.(int)$order_detail['product_attribute_id'] : '').'.jpg'; $order_detail['image_tag'] = ImageManager::thumbnail(_PS_IMG_DIR_.'p/'.$order_detail['image']->getExistingImgPath().'.jpg', $name, 45, 'jpg', false); if (file_exists(_PS_TMP_IMG_DIR_.$name)) $order_detail['image_size'] = getimagesize(_PS_TMP_IMG_DIR_.$name); else $order_detail['image_size'] = false; } } $this->smarty->assign(array( 'order' => $this->order, 'order_details' => $order_details, 'delivery_address' => $formatted_delivery_address, 'invoice_address' => $formatted_invoice_address, 'order_invoice' => null, 'carrier' => $carrier )); return $this->smarty->fetch($this->getTemplate('delivery-slip')); } Fichier pdf/delivery-slip.tpl {foreach from=$order->getOrderPaymentCollection() item=payment} Et je m'affranchis de toute référence à la facture pour générer mon BL ! Prochaine étape : coder la demande de BL dans les états de commande sans générer de facture... Edited February 23, 2016 by AmigaINC (see edit history) Link to comment Share on other sites More sharing options...
AmigaINC Posted February 19, 2016 Share Posted February 19, 2016 (edited) Etape 2 : ne pas générer la facture quand BL seul demandé Dans classes/order/OrderHistory.php if ($new_os->invoice && !$order->invoice_number) $order->setInvoice($use_existing_payment); elseif ($new_os->delivery && !$order->delivery_number) $order->setDeliverySlip((!$new_os->invoice && !$order->invoice_number)); Dans classes/order/Order.php public function getDeliveryNumber($order_invoice_id = false) { if (!$order_invoice_id) return Db::getInstance()->getValue(' SELECT MAX(`delivery_number`)+1 FROM `' . _DB_PREFIX_ . 'orders`' ); return Db::getInstance()->getValue(' SELECT `delivery_number` FROM `' . _DB_PREFIX_ . 'order_invoice` WHERE `id_order_invoice` = ' . (int) $order_invoice_id ); } Et public function setDeliverySlip($delivery_only = false) { if (!$this->delivery_number) { if (!$delivery_only) { $order_invoice = new OrderInvoice(); $order_invoice->id_order = $this->id; $order_invoice->number = 0; $order_invoice->add(); } $this->delivery_date = $order_invoice->date_add; $this->delivery_number = $this->getDeliveryNumber(); $this->update(); } } Prochaine étape : apprendre à utiliser les override... Edited February 19, 2016 by AmigaINC (see edit history) Link to comment Share on other sites More sharing options...
akhawat Posted February 21, 2016 Author Share Posted February 21, 2016 bonjour merci pour ces precieuses infos, j'ai commencé a faire les modifications bie que les codes soient différent sur la 1.5.6 je cale sur le Fichier pdf/delivery-slip.php je ne letrouve pas je trouve Fichier pdf/delivery-slip.tpl cdlt Link to comment Share on other sites More sharing options...
AmigaINC Posted February 23, 2016 Share Posted February 23, 2016 je cale sur le Fichier pdf/delivery-slip.php je ne letrouve pas je trouve Fichier pdf/delivery-slip.tpl Vous avez raison, au temps pour moi, c'est bien .tpl Je corrige mon post précédent. Link to comment Share on other sites More sharing options...
akhawat Posted May 9, 2016 Author Share Posted May 9, 2016 bonjour j'ai tout essayé enfin de dans la limite de mes compétence mais rien a faire, j'ai donc acheté un module qui me permet d'imprimer un devis sans que la facture ne soit éditée cela me sert de BL en attendant le paiement. si quelqu'un a reglé le problème je suis quand même prenneur. cdlt Link to comment Share on other sites More sharing options...
Panas Posted August 28, 2016 Share Posted August 28, 2016 Bonjour, Il faut fouiller coté statut...dire que quand ça passe pas en expédier on édite que le bl. 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