Swysbad Posted December 3, 2013 Share Posted December 3, 2013 (edited) Bonjour, Je me heurte a un problème de taille, j'aimerais que dans ma facture seul le nom du produit apparaisse (sans tous les attributs à la suite). Pouvez-vous m'indiquer le ou les fichier(s) php et/ou tpl à modifier pour parvenir à ce résultat MERCI Edited December 4, 2013 by Swysbad (see edit history) Link to comment Share on other sites More sharing options...
be_tnt Posted December 3, 2013 Share Posted December 3, 2013 Hello! Il te faut overrider (surcharger) le fichier invoice.tpl situé dans le répertoire pdf. Si tu modifies directement le fichier à la source, à la prochaine mise à jour, il sera écraser. @+ Link to comment Share on other sites More sharing options...
Swysbad Posted December 4, 2013 Author Share Posted December 4, 2013 Merci pour la réponse, mais hélas ce n'est pas la bonne . Dans invoice.tpl on retrouve "{$order_detail.product_name}" la variable smarty qui regroupe "nom + attributs" . Il faut donc modifier plus haut (au niveau la génération de cette variable), donc dans un fichier php dans classes/ . J'ai modifié PDF.php et OrderDetail.php sans résultat pour l'instant. Link to comment Share on other sites More sharing options...
be_tnt Posted December 4, 2013 Share Posted December 4, 2013 $order_details est défini dans la classe HTMLTemplateInvoice, fonction getContent(). 'order_details' => $this->order_invoice->getProducts(), le getProducts() est défini dans la classe OrderInvoice: public function getProducts($products = false, $selectedProducts = false, $selectedQty = false) { if (!$products) $products = $this->getProductsDetail(); $order = new Order($this->id_order); $customized_datas = Product::getAllCustomizedDatas($order->id_cart); $resultArray = array(); foreach ($products as $row) { // Change qty if selected if ($selectedQty) { $row['product_quantity'] = 0; foreach ($selectedProducts as $key => $id_product) if ($row['id_order_detail'] == $id_product) $row['product_quantity'] = (int)($selectedQty[$key]); if (!$row['product_quantity']) continue; } $this->setProductImageInformations($row); $this->setProductCurrentStock($row); $this->setProductCustomizedDatas($row, $customized_datas); // Add information for virtual product if ($row['download_hash'] && !empty($row['download_hash'])) { $row['filename'] = ProductDownload::getFilenameFromIdProduct((int)$row['product_id']); // Get the display filename $row['display_filename'] = ProductDownload::getFilenameFromFilename($row['filename']); } $row['id_address_delivery'] = $order->id_address_delivery; /* Stock product */ $resultArray[(int)$row['id_order_detail']] = $row; } if ($customized_datas) Product::addCustomizationPrice($resultArray, $customized_datas); return $resultArray; } A mon avis (comme cela sans avoir testé), la fonction que tu dois surcharger, c'est celle-là. Link to comment Share on other sites More sharing options...
Swysbad Posted December 4, 2013 Author Share Posted December 4, 2013 Enfaite j'ai trouvé, enfin! la variable "product_name" est défini dans Classes/order/OrderDetail.php donc j'ai juste modifié le fichier override/classes/order/OrderDetail.php comme ceci : class OrderDetail extends OrderDetailCore { protected function create(Order $order, Cart $cart, $product, $id_order_state, $id_order_invoice, $use_taxes = true, $id_warehouse = 0) { if ($use_taxes) $this->tax_calculator = new TaxCalculator(); $this->id = null; $this->product_id = (int)($product['id_product']); $this->product_attribute_id = (int)($product['id_product_attribute'] ? (int)($product['id_product_attribute']) : null); $this->product_name = $product['name']; /* . ((isset($product['attributes']) && $product['attributes'] != null) ? ' - '.$product['attributes'] : ''); */ $this->product_quantity = (int)($product['cart_quantity']); $this->product_ean13 = empty($product['ean13']) ? null : pSQL($product['ean13']); $this->product_upc = empty($product['upc']) ? null : pSQL($product['upc']); $this->product_reference = empty($product['reference']) ? null : pSQL($product['reference']); $this->product_supplier_reference = empty($product['supplier_reference']) ? null : pSQL($product['supplier_reference']); $this->product_weight = (float)($product['id_product_attribute'] ? $product['weight_attribute'] : $product['weight']); $this->id_warehouse = $id_warehouse; $productQuantity = (int)(Product::getQuantity($this->product_id, $this->product_attribute_id)); $this->product_quantity_in_stock = ($productQuantity - (int)($product['cart_quantity']) < 0) ? $productQuantity : (int)($product['cart_quantity']); $this->setVirtualProductInformation($product); $this->checkProductStock($product, $id_order_state); if ($use_taxes) $this->setProductTax($order, $product); $this->setShippingCost($order, $product); $this->setDetailProductPrice($order, $cart, $product); // Set order invoice id $this->id_order_invoice = (int)$id_order_invoice; // Set shop id $this->id_shop = (int)$product['id_shop']; // Add new entry to the table $this->save(); if ($use_taxes) $this->saveTaxCalculator($order); unset($this->tax_calculator); } } Enjoy merci beaucoup sujet résolu 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