Bonjour, le thème de mon passage aujourd'hui : modifier les factures de VM3
...j'en ai déjà causé dans le coin. "de base, c'est moche et n'importe quoi", fort heureusement notre couple Joomla et Virtuemart est souple et modifiable à souhait
la bidouille du jour concerne :
virtuemart 3 sous joomla3
je suis arrivé à modifier les "factures" en ajoutant quelques fichiers à mon template.
une copie du dossier /components/com_virtuemart/views/orders/tmpl
vers
/templates/mon-template/html/com_virtuemart/orders/
contenant les fichiers suivants
index.html
details.php
details.xml
details_history.php
details_items.php
details_order.php
details_pdf.php
list.php
list.xml
Modifs de details.php :
je commente la ligne suivante
Modifs de details_history.php :
ici une grande partie du code "php" est commenté ...ça ne me sert à rien. "toi non-plus ? ...alors fais pareil".
Modifs de details_items.php :
(je repasserai par ici, car j'ai un décalage "à corriger" pour le total au bas de la facture sur les webmails) ...et ce n'est pas visible avec thunderbird
je change la taille de colonnes
Pas de modifs dans "details_order.php" ni dans "details_pdf.php".
Modifs de list.php :
basé sur une version plus ancienne je n'ai pas cette ligne 61 ...pas grave dans mon cas :
je change aussi les lignes :
par ceci :
fin de la première partie !
seconde partie : intimement lié, jai également une surcharge /templates/mon-template/html/com_virtuemart/invoice
contenant les fichiers :
index.html
invoice.php
invoice_history.php
invoice_items.php
invoice_order.php
mail_html_header.php
modification de invoice.php :
je commente une partie de la ligne 84
et je commente les lignes de 95 à 99 comme ceci :
modifications pour le fichier invoice_history.php :
ici, je commente une grande partie du code "php" de cette façon :
Modification de invoice_items.php :
j'agence les colonnes du tableau à ma façon :
...je commente la ligne status du produit.
ligne 50 et 51, comme ma base est une version plus ancienne, je n'est pas les lignes :
Modifications du fichier invoice_order.php :
je change le code d'origine ci dessous :
par ceci
Pour finir je modifie le mail :
en bas du fichier, je remplace
par
voilà c'est fini je pense avoir noté toutes mes modifications pour les factures et la page des commandes clients.
...j'en ai déjà causé dans le coin. "de base, c'est moche et n'importe quoi", fort heureusement notre couple Joomla et Virtuemart est souple et modifiable à souhait
la bidouille du jour concerne :
virtuemart 3 sous joomla3
je suis arrivé à modifier les "factures" en ajoutant quelques fichiers à mon template.
une copie du dossier /components/com_virtuemart/views/orders/tmpl
vers
/templates/mon-template/html/com_virtuemart/orders/
contenant les fichiers suivants
index.html
details.php
details.xml
details_history.php
details_items.php
details_order.php
details_pdf.php
list.php
list.xml
Modifs de details.php :
je commente la ligne suivante
Code:
/* $tabarray['history'] = 'COM_VIRTUEMART_ORDER_HISTORY'; */
Modifs de details_history.php :
ici une grande partie du code "php" est commenté ...ça ne me sert à rien. "toi non-plus ? ...alors fais pareil".
Modifs de details_items.php :
(je repasserai par ici, car j'ai un décalage "à corriger" pour le total au bas de la facture sur les webmails) ...et ce n'est pas visible avec thunderbird
je change la taille de colonnes
Code:
<tr align="left" class="sectiontableheader"> <th align="left" width="5%"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_SKU') ?></th> <th align="left" colspan="2" width="40%" ><?php echo vmText::_('COM_VIRTUEMART_PRODUCT_NAME_TITLE') ?></th> <th align="center" width="10%"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PRODUCT_STATUS') ?></th> <th align="right" width="10%" ><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PRICE') ?></th> <th align="right" width="5%"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_QTY') ?></th> <?php if ( VmConfig::get('show_tax')) { ?> <th align="right" width="10%" ><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PRODUCT_TAX') ?></th> <?php } ?> <th align="right" width="11%"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_SUBTOTAL_DISCOUNT_AMOUNT') ?></th> <th align="right" width="10%"><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_TOTAL') ?></th> </tr>
Modifs de list.php :
basé sur une version plus ancienne je n'ai pas cette ligne 61 ...pas grave dans mon cas :
Code:
<?php echo shopFunctionsF::getInvoiceDownloadButton($row) ?>
Code:
<!--td align="left"> <?php //echo vmJsApi::date($row->modified_on,'LC3',true); ?> </td --> <td align="left"> <?php echo shopFunctionsF::getOrderStatusName($row->order_status); ?> </td>
Code:
<!--td align="left"> <?php //echo vmJsApi::date($row->modified_on,'LC3',true); ?> </td --> <!--td align="left"> <?php //echo shopFunctionsF::getOrderStatusName($row->order_status); ?> </td-->
seconde partie : intimement lié, jai également une surcharge /templates/mon-template/html/com_virtuemart/invoice
contenant les fichiers :
index.html
invoice.php
invoice_history.php
invoice_items.php
invoice_order.php
mail_html_header.php
modification de invoice.php :
je commente une partie de la ligne 84
Code:
$tabarray = array('items'=>'COM_VIRTUEMART_ORDER_ITEM'/*, 'history'=>'COM_VIRTUEMART_ORDER_HISTORY'*/);
Code:
/* if ($this->vendor->vendor_letter_add_tos) {?> <div class="invoice_tos" <?php if ($this->vendor->vendor_letter_add_tos_newpage) { ?> style="page-break-before: always"<?php } ?>> <?php echo $this->vendor->vendor_terms_of_service; ?> </div> <?php } */
ici, je commente une grande partie du code "php" de cette façon :
Code:
<?php /* <table width="100%" cellspacing="2" cellpadding="4" border="0"> <tr align="left" class="sectiontableheader"> <th align="left" width="15%"><strong><?php echo vmText::_('COM_VIRTUEMART_DATE') ?></strong></th> <th align="left" width="15%"><strong><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PO_STATUS') ?></strong></th> <th align="left" ><strong><?php echo vmText::_('COM_VIRTUEMART_ORDER_COMMENT') ?></strong></th> </tr> <?php foreach($this->orderDetails['history'] as $_hist) { if (!$_hist->customer_notified) { continue; } ?> <tr valign="top"> <td align="left" > <?php echo vmJsApi::date($_hist->created_on, 'LC4', true); ?> </td> <td align="left" > <?php echo $this->orderstatuses[$_hist->order_status_code]; ?> </td> <td align="left" > <?php echo $_hist->comments; ?> </td> </tr> <?php } ?> </table> */?>
Modification de invoice_items.php :
j'agence les colonnes du tableau à ma façon :
...je commente la ligne status du produit.
Code:
<tr align="left" class="sectiontableheader" style="background-color: #d1d1d1;"> <td align="left" width="25%"><strong><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_SKU') ?></strong></td> <td align="left" colspan="2" width="27%" ><strong><?php echo vmText::_('COM_VIRTUEMART_PRODUCT_NAME_TITLE') ?></strong></td> <!--td align="center" width="10%"><strong><?php //echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PRODUCT_STATUS') ?></strong></td--> <?php if ($this->doctype == 'invoice') { ?> <td align="right" width="10%" ><strong>Unit H.T</strong></td> <?php } ?> <td align="right" width="6%"><strong><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_QTY') ?></strong></td> <?php if ($this->doctype == 'invoice') { ?> <?php if ( VmConfig::get('show_tax')) { ?> <td align="right" width="10%" ><strong><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PRODUCT_TAX') ?></strong></td> <?php } ?> <td align="right" width="11%"><strong><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_SUBTOTAL_DISCOUNT_AMOUNT') ?></strong></td> <td align="right" width="11%"><strong><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_TOTAL') ?></strong></td> <?php } ?> </tr>
Code:
if(!class_exists('VirtueMartModelCustomfields'))require(VMPATH_ADMIN.DS.'models'.DS.'customfields.php'); VirtueMartModelCustomfields::$useAbsUrls = ($this->isMail or $this->isPdf);
je change le code d'origine ci dessous :
Code:
<?php /** * * Order detail view * * @package VirtueMart * @subpackage Orders * @author Oscar van Eijk, Valerie Isaksen * @link http://www.virtuemart.net * @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php * VirtueMart is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * @version $Id: details_order.php 5341 2012-01-31 07:43:24Z alatak $ */ // Check to ensure this file is included in Joomla! defined('_JEXEC') or die('Restricted access'); ?> <?php if ($this->doctype == 'invoice') { if ($this->invoiceNumber) { ?> <h1><?php echo vmText::_('COM_VIRTUEMART_INVOICE').' '.$this->invoiceNumber; ?> </h1> <?php } } elseif ($this->doctype == 'deliverynote') { ?> <h1><?php echo vmText::_('COM_VIRTUEMART_DELIVERYNOTE'); ?> </h1> <?php } elseif ($this->doctype == 'confirmation') { ?> <h1><?php echo vmText::_('COM_VIRTUEMART_CONFIRMATION'); ?> </h1> <?php } ?> <table width="100%" cellspacing="0" cellpadding="0" border="0"> <?php if ($this->invoiceNumber) { ?> <tr> <td class=""><?php echo vmText::_('COM_VIRTUEMART_INVOICE_DATE') ?></td> <td align="left"><?php echo vmJsApi::date($this->invoiceDate, 'LC4', true); ?></td> </tr> <?php } ?> <?php if (!empty($this->orderDetails['details']['BT']->delivery_date)) { ?> <tr> <td class=""><?php echo vmText::_('COM_VIRTUEMART_DELIVERY_DATE') ?></td> <td align="left"><?php echo $this->orderDetails['details']['BT']->delivery_date ?></td> </tr> <?php } ?> <tr> <td ><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PO_NUMBER') ?></td> <td align="left"><strong> <?php echo $this->orderDetails['details']['BT']->order_number; ?> </strong> </td> </tr> <tr> <td class=""><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PO_DATE') ?></td> <td align="left"><?php echo vmJsApi::date($this->orderDetails['details']['BT']->created_on, 'LC4', true); ?></td> </tr> <tr> <td class=""><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PO_STATUS') ?></td> <td align="left"><?php echo $this->orderstatuses[$this->orderDetails['details']['BT']->order_status]; ?></td> </tr> <tr> <td class=""><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_SHIPMENT_LBL') ?></td> <td align="left"><?php echo $this->orderDetails['shipmentName']; ?></td> </tr> <tr> <td class=""><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PAYMENT_LBL') ?></td> <td align="left"><?php echo $this->orderDetails['paymentName']; ?> </td> </tr> <?php if ($this->orderDetails['details']['BT']->customer_note) { ?> <tr> <td><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_CUSTOMER_NOTE') ?></td> <td valign="top" align="left" width="50%"><?php echo $this->orderDetails['details']['BT']->customer_note; ?></td> </tr> <?php } ?> <?php if ($this->doctype == 'invoice') { ?> <tr> <td class="orders-key"><strong><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_TOTAL') ?></strong></td> <td class="orders-key" align="left"><strong><?php echo $this->currency->priceDisplay($this->orderDetails['details']['BT']->order_total,$this->currency); ?></strong></td> </tr> <?php } ?> <tr> <td colspan="2"></td> </tr> <tr> <td valign="top"><strong> <?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_BILL_TO_LBL') ?></strong> <br/> <table border="0"><?php foreach ($this->userfields['fields'] as $field) { if (!empty($field['value'])) { echo '<tr><td class="key">' . $field['title'] . '</td>' . '<td>' . $field['value'] . '</td></tr>'; } } ?></table> </td> <td valign="top" ><strong> <?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_SHIP_TO_LBL') ?></strong><br/> <table border="0"><?php foreach ($this->shipmentfields['fields'] as $field) { if (!empty($field['value'])) { echo '<tr><td class="key">' . $field['title'] . '</td>' . '<td>' . $field['value'] . '</td></tr>'; } } ?></table> </td> </tr> </table>
Code:
<?php /** * * Order detail view * * @package VirtueMart * @subpackage Orders * @author Oscar van Eijk, Valerie Isaksen * @link http://www.virtuemart.net * @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php * VirtueMart is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * @version $Id: details_order.php 5341 2012-01-31 07:43:24Z alatak $ */ // Check to ensure this file is included in Joomla! defined('_JEXEC') or die('Restricted access'); ?> <?php if ($this->doctype == 'invoice') { if ($this->invoiceNumber) { ?> <h1 align="right"><?php echo vmText::_('COM_VIRTUEMART_INVOICE').' N° : '.$this->invoiceNumber; ?> </h1> <?php } } elseif ($this->doctype == 'deliverynote') { ?> <h1><?php echo vmText::_('COM_VIRTUEMART_DELIVERYNOTE'); ?> </h1> <?php } elseif ($this->doctype == 'confirmation') { ?> <h1><?php echo vmText::_('COM_VIRTUEMART_CONFIRMATION'); ?> </h1> <?php } ?> <table width="100%" cellspacing="0" cellpadding="0" border="0"> <?php if ($this->invoiceNumber) { ?> <tr> <td class=""><?php echo vmText::_('COM_VIRTUEMART_INVOICE_DATE') ?> : <?php echo vmJsApi::date($this->invoiceDate, 'LC4', true); ?></td> </tr> <?php } ?> <?php /*if (!empty($this->orderDetails['details']['BT']->delivery_date)) { ?> <tr> <td class=""><?php echo vmText::_('COM_VIRTUEMART_DELIVERY_DATE') ?></td> <td align="left"><?php echo $this->orderDetails['details']['BT']->delivery_date ?></td> </tr> <?php } */?> <!--tr> <td ><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PO_NUMBER') ?></td> <td align="left"><strong> <?php echo $this->orderDetails['details']['BT']->order_number; ?> </strong> </td> </tr> <tr> <td class=""><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PO_DATE') ?></td> <td align="left"><?php echo vmJsApi::date($this->orderDetails['details']['BT']->created_on, 'LC4', true); ?></td> </tr> <tr> <td class=""><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PO_STATUS') ?></td> <td align="left"><?php echo $this->orderstatuses[$this->orderDetails['details']['BT']->order_status]; ?></td> </tr> <tr> <td class=""><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_SHIPMENT_LBL') ?></td> <td align="left"><?php echo $this->orderDetails['shipmentName']; ?></td> </tr--> <tr> <td class=""><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_PAYMENT_LBL') ?> : <?php echo $this->orderDetails['paymentName']; ?> </td> <hr> </tr> <?php /*if ($this->orderDetails['details']['BT']->customer_note) { ?> <tr> <td><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_CUSTOMER_NOTE') ?></td> <td valign="top" align="left" width="50%"><?php echo $this->orderDetails['details']['BT']->customer_note; ?></td> </tr> <?php } ?> <?php if ($this->doctype == 'invoice') { ?> <tr> <td class="orders-key"><strong><?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_TOTAL') ?></strong></td> <td class="orders-key" align="left"><strong><?php echo $this->currency->priceDisplay($this->orderDetails['details']['BT']->order_total,$this->currency); ?></strong></td> </tr> <?php } */?> <tr> <td colspan="2"></td> </tr> <tr> <td valign="top"><strong> <?php //echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_BILL_TO_LBL') ?></strong> <br/> <table border="0";><?php echo '<tr><td class="key">' . $this->userfields['fields']['title']['value'] . ' ' . $this->userfields['fields']['first_name']['value'] . ' ' . $this->userfields['fields']['last_name']['value'] . '<br/>' . $this->userfields['fields']['address_1']['value'] . '<br/>' . $this->userfields['fields']['address_']['value'] . '<br/>' . $this->userfields['fields']['zip']['value'] . ' ' . $this->userfields['fields']['city']['value'] . '</td></tr>'; ?></table> </td> <!--td valign="top" ><strong> <?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_SHIP_TO_LBL') ?></strong><br/> <table border="0"><?php foreach ($this->shipmentfields['fields'] as $field) { if (!empty($field['value'])) { echo '<tr><td class="key">' . $field['title'] . '</td>' . '<td>' . $field['value'] . '</td></tr>'; } } ?></table> </td--> </tr> </table>
en bas du fichier, je remplace
Code:
<strong><?php echo JText::sprintf ('COM_VIRTUEMART_MAIL_SHOPPER_NAME', $this->orderDetails['details']['BT']->title . ' ' . $this->orderDetails['details']['BT']->first_name . ' ' . $this->orderDetails['details']['BT']->last_name); ?></strong><br/>
Code:
<strong><?php echo vmText::sprintf ('COM_VIRTUEMART_MAIL_SHOPPER_NAME', $this->civility . ' ' . $this->orderDetails['details']['BT']->first_name . ' ' . $this->orderDetails['details']['BT']->last_name); ?></strong><br/>
Commentaire