Skip to main content

PDF Invoice: Template changed, how to lock changes in case of updates

More
3 hours 10 minutes ago #100000271 by P.M.
-- url of the page with the problem -- : www.breisig.live/
-- HikaShop version -- : 6.6.0
-- Joomla version -- : 6.2.0
-- PHP version -- : 8.4.23
-- Browser(s) name and version -- : Firefox 158.0

Hey,
I’ve modified the template for the invoicing plugin, ‘flat_invoice.php’, as follows:
Code:
<?php /** * @package PDF invoice plugin for HikaShop * @version 5.2.9 * @author Adrien Baborier, Hikari Software * @copyright (C) 2010-2026 HIKARI SOFTWARE. All rights reserved. * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html */ defined('_JEXEC') or die('Restricted access'); ?><?php $color = $this->params->get('invoice_color'); // ============================================================================ // EINFACH ANPASSBARE BREISIG.live ANGABEN // Diese Werte bei Bedarf ändern; die Vorlagenstruktur darunter kann bleiben. // ============================================================================ $brandSlogan = 'Wir machen Kultur.'; $brandWebsite = 'www.BREISIG.live'; $brandEmail = 'ticketing@breisig.live'; $brandReturnAddress = 'BREISIG.live e.V. | Eulengasse 24 | 53498 Bad Breisig'; $brandAccent = '#a88742'; ?> <style type='text/css'> page {font-family: 'Segoe UI';} tr.order_end td {border-width: 0;} .products td:last-child {border-width: 0 0 1px 1px;} .order_end td:last-child {border-width: 0 0 0 1px;} .hika_invoice_img {text-align: center;} table.header {width: 100%; border-collapse: collapse; margin: 0 auto;} table.brand_header {width: 100%; border-collapse: collapse; margin: 0 auto;} table.invoice_meta {width: 100%; border-collapse: collapse; margin: 4px auto 0;} .brand_header td {text-align: center;} .brand_logo {padding-top: 2px;} .brand_slogan {font-size: 22px; color: <?php echo $brandAccent; ?>; padding-top: 2px;} .brand_contact {font-size: 12px; color: <?php echo $brandAccent; ?>; padding-top: 1px;} .brand_return {text-align: left; font-size: 10px; color: #555; padding-top: 8px;} .header_rule td {height: 3px; border-bottom: 1px solid <?php echo $brandAccent; ?>;} .invoice_meta td {vertical-align: top; padding: 2px 0;} .invoice_type {font-size: 20px; font-weight: bold; color: #444; text-align: left; padding: 0 0 5px;} .invoice_label {width: 22%; font-weight: bold; text-align: left;} .invoice_value {width: 38%; font-weight: bold; text-align: left;} .invoice_date {width: 40%; text-align: left; color: #444; font-size: 13px; white-space: nowrap;} .invoice_date_label {font-weight: normal; font-size: 13px;}.legend { padding: 5px 10px;     margin-bottom: 10px;     color: #000;     font-weight: bold;     background-color: <?php echo $color; ?>;     border: 2px solid <?php echo $color; ?>;     font-size: 1.2em; } div.date {     text-align: center;     color: #000;     font-size: 1.2em; } .storeaddress{ text-align: center; color:#333; padding: 5px; } .addresses{padding-top:12px;} .addresses td{padding: 0 0 0 60px;} .addresses .fieldset {width: 230px;} table.products{margin: 30px 80px 30px 10px;width:600px;border-collapse:collapse} .address_text {padding: 0 0 0 10px;} .price{text-align:center;} .products td, .products th {padding: 7px 4px;} .products th:first-child {text-align: left;} .products th {     background-color: <?php echo $color; ?>;     color: #000; } td.newarea{text-align:right;padding-right:20px;} tr.total{font-weight:bold;} .products tr.limitation td{background-color:#ccc;padding:1px 0px;} .hikashop_order_custom_fields_fieldset{margin-top : 20px;} .hikashop_order_extra_table th, .hikashop_order_extra_table td {text-align: left !important;} .footer{font-size:11px;color:#444444;text-align:left;border-top:2px solid <?php echo $brandAccent; ?>;padding-top:7px;} </style> <page style='font-size: 12px' backtop='8mm' backbottom='14mm' backleft='10mm' backright='10mm'> <page_footer> <div class='footer'> <?php $name = $this->params->get('footer'); $trans = hikashop_translate($name); echo str_replace(array('\r\n','\n','\r'),array('<br/>','<br/>','<br/>'), $trans); ?> </div> </page_footer> <?php // HikaShop order data: keep invoice/shipping invoice and credit note support. if(empty($order->order_invoice_number)) $order->order_invoice_number = $order->order_number; if(empty($order->order_invoice_created)) $order->order_invoice_created = $order->order_created; if($this->shipping_invoice){ $number = \Joomla\CMS\Language\Text::_('SHIPPING_INVOICE').' n° '; if(\Joomla\CMS\Language\Text::_('SHIPPING_INVOICE_NUMBER') != 'SHIPPING_INVOICE_NUMBER') $number = \Joomla\CMS\Language\Text::_('SHIPPING_INVOICE_NUMBER').' '; $item_type = 'display:back_shipping_invoice=1'; }else{ if(!empty($this->credit_note)) { $number = \Joomla\CMS\Language\Text::_('CREDIT_NOTE_NUMBER').' '; } else { $number = \Joomla\CMS\Language\Text::_('INVOICE').' n° '; if(\Joomla\CMS\Language\Text::_('INVOICE_NUMBER') != 'INVOICE_NUMBER') $number = \Joomla\CMS\Language\Text::_('INVOICE_NUMBER').' '; } $item_type = 'display:back_invoice=1'; } ?> <!-- KOPF: Logo und Vereinsauftritt --> <table class='brand_header'><tbody> <tr><td class='brand_logo' colspan='2'> <?php $image_address_path = trim($config->get('image_address_path')); if(!empty($image_address_path)) { $image_address_path = hikashop_cleanURL($image_address_path); $img_style_css = trim(strip_tags($config->get('img_style_css'))); $img_style = $img_style_css != '' ? $img_style_css : 'width: 100px;'; ?> <img src='<?php echo $image_address_path; ?>' style='<?php echo $img_style; ?>'> <?php } ?> <div class='brand_slogan'><?php echo $brandSlogan; ?></div> <div class='brand_contact'><?php echo $brandWebsite; ?> &nbsp;|&nbsp; <?php echo $brandEmail; ?></div> </td></tr> <tr><td class='brand_return' colspan='2'><?php echo $brandReturnAddress; ?></td></tr> <tr class='header_rule'><td colspan='2'></td></tr> </tbody></table> <!-- KOPF: Rechnungsdaten --> <table class='invoice_meta'> <tbody> <tr> <td class='invoice_type' colspan='3'>RECHNUNG</td> </tr> <tr> <td class='invoice_label'><?php echo $number; ?></td> <td class='invoice_value'><?php echo $order->order_invoice_number; ?></td> <td class='invoice_date'><span class='invoice_date_label'>Datum:</span>&nbsp;<?php echo hikashop_getDate($order->order_invoice_created, '%d %B %Y, %H:%M').' Uhr'; ?></td> </tr> <tr> <td class='invoice_label'>Bestellnummer:</td> <td class='invoice_value'><?php echo $order->order_number; ?></td> <td></td> </tr> </tbody> </table><?php if(!empty($this->credit_note) && !empty($order->original_invoice_number)) { ?> <div class='originalinvoiceref' style='margin-bottom:10px;'><?php if(!empty($order->original_invoice_created)) { echo \Joomla\CMS\Language\Text::sprintf('REFUND_OF_INVOICE_X_DATED_Y', $order->original_invoice_number, hikashop_getDate($order->original_invoice_created, '%d %B %Y')); } else { echo \Joomla\CMS\Language\Text::sprintf('REFUND_OF_INVOICE_X', $order->original_invoice_number); } ?></div> <?php } ?> <table class='addresses'> <tr> <?php $addresses = array('billing_address','shipping_address'); foreach($addresses as $oneAddress){ if(empty($order->$oneAddress)) continue; if ($oneAddress=='shipping_address' && empty($pluginsShipping)) continue; ?> <td valign='top'> <div class='fieldset'> <!-- ADDRESS TITLE --> <div class='legend'><?php echo \Joomla\CMS\Language\Text::_('HIKASHOP_'.strtoupper($oneAddress)); ?></div> <!-- EO ADDRESS TITLE --> <!-- ADDRESS CONTENT --> <div class='address_text'> <?php $override = false; if(!empty($order->override_shipping_address) && $oneAddress=='shipping_address') { $override = $order->override_shipping_address; } if($override !== false ) { echo $override; } else { $addressClass = hikashop_get('class.address'); if(hikashop_isClient('administrator')){ $view = 'order'; }else{ $view = 'address'; } echo $addressClass->displayAddress($order->fields,$order->$oneAddress,$view); } ?> </div> <!-- EO ADDRESS CONTENT --> </div> </td> <?php } ?> </tr> </table> <?php $shipping_invoice = ''; if($this->shipping_invoice){ $shipping_invoice = 'shipping_'; } $weight = bccomp(sprintf('%F',$order->order_weight), 0, 3); $unit_weight = false; if($weight && $config->get('show_'.$shipping_invoice.'invoice_unit_weight',0)) $unit_weight = true; $total_weight = false; if($weight && $config->get('show_'.$shipping_invoice.'invoice_total_weight',0)) $total_weight = true; $order_weight = false; if($weight && $config->get('show_'.$shipping_invoice.'invoice_weight',0)) $order_weight = true; ?> <table class='products'> <tr class='products_title'> <!-- PRODUCT NAME TITLE --> <?php if($this->shipping_invoice){ ?> <th style='width:500px'> <?php }else{ ?> <th style='width:300px'> <?php } ?> <?php echo \Joomla\CMS\Language\Text::_('PRODUCT'); ?> </th> <!-- EO PRODUCT NAME TITLE --> <!-- PRODUCT WEIGHT TITLE --> <?php if($unit_weight) { ?> <th style='width:80px' class='price'><?php echo \Joomla\CMS\Language\Text::_('PRODUCT_WEIGHT'); ?></th><?php } ?> <!-- EO PRODUCT WEIGHT TITLE --> <!-- UNIT PRICE TITLE --> <?php if(!$this->shipping_invoice){ ?> <th style='width:100px' class='price'> <?php echo \Joomla\CMS\Language\Text::_('UNIT_PRICE'); ?> </th> <?php } ?> <!-- EO UNIT PRICE TITLE --> <!-- PRODUCT QUANTITY TITLE --> <th style='width:80px' class='price'> <?php echo \Joomla\CMS\Language\Text::_('PRODUCT_QUANTITY'); ?> </th> <!-- EO PRODUCT QUANTITY TITLE --> <!-- TOTAL WEIGHT TITLE --> <?php if($total_weight) { ?> <th style='width:80px' class='price'><?php echo \Joomla\CMS\Language\Text::_('TOTAL_WEIGHT'); ?></th><?php } ?> <!-- EO TOTAL WEIGHT TITLE --> <!-- TOTAL PRICE TITLE --> <?php if(!$this->shipping_invoice){ ?> <th style='width:100px' class='price'> <?php echo \Joomla\CMS\Language\Text::_('PRICE'); ?> </th> <?php } ?> <!-- EO TOTAL PRICE TITLE --> </tr> <?php $fieldsClass = hikashop_get('class.field'); $group = $config->get('group_options',0); foreach($order->products as $product){ if($group && $product->order_product_option_parent_id) continue; ?> <tr> <!-- PRODUCT NAME --> <td> <?php echo '<b>'; echo implode('<br/>',$this->str_split_unicode(strip_tags($product->order_product_name),50)); echo '</b>'; if($group && !$this->shipping_invoice){ $display_item_price=false; foreach($order->products as $j => $optionElement){ if($optionElement->order_product_option_parent_id != $product->order_product_id) continue; if($optionElement->order_product_price>0){ $display_item_price = true; } } if($display_item_price){ if($config->get('price_with_tax')){ echo ' '.$currencyHelper->format($product->order_product_price+$product->order_product_tax,$order->order_currency_id); }else{ echo ' '.$currencyHelper->format($product->order_product_price,$order->order_currency_id); } } } $itemFields = $fieldsClass->getFields($item_type,$product,'item'); if(!empty($itemFields)){ foreach($itemFields as $field){ $namekey = $field->field_namekey; if(!empty($product->$namekey) && strlen($product->$namekey)) { $field->currentElement = $product; echo '<p>'.implode('<br/>',$this->str_split_unicode(strip_tags($fieldsClass->getFieldName($field).': '.$fieldsClass->show($field,$product->$namekey,'user_email')),50)).'</p>'; } } } if($group){ foreach($order->products as $j => $optionElement){ if($optionElement->order_product_option_parent_id != $product->order_product_id) continue; $product->order_product_weight += $optionElement->order_product_weight; $product->order_product_price +=$optionElement->order_product_price; $product->order_product_tax +=$optionElement->order_product_tax; $product->order_product_total_price+=$optionElement->order_product_total_price; $product->order_product_total_price_no_vat+=$optionElement->order_product_total_price_no_vat; ?><br/><?php $option_name = $optionElement->order_product_name; if($optionElement->order_product_price>0 && !$this->shipping_invoice){ if($config->get('price_with_tax')){ $option_name .= ' ( + '.$currencyHelper->format($optionElement->order_product_price+$optionElement->order_product_tax,$order->order_currency_id).' )'; }else{ $option_name .= ' ( + '.$currencyHelper->format($optionElement->order_product_price,$order->order_currency_id).' )'; } } echo '<p>'.implode('<br/>', $this->str_split_unicode(strip_tags($option_name),50)).'</p>'; } } if ($config->get('show_code')) { echo '<br/>'.$product->order_product_code; } ?> </td> <!-- EO PRODUCT NAME --> <!-- PRODUCT WEIGHT --> <?php if($unit_weight) { ?> <td class='price'><?php echo rtrim(rtrim($product->order_product_weight,'0'),',.').' '.\Joomla\CMS\Language\Text::_($product->order_product_weight_unit); ?></td><?php } ?> <!-- EO PRODUCT WEIGHT --> <!-- UNIT PRICE --> <?php if(!$this->shipping_invoice){ ?> <td  class='price'> <?php if($config->get('price_with_tax')){ echo $currencyHelper->format($product->order_product_price+$product->order_product_tax,$order->order_currency_id); }else{ echo $currencyHelper->format($product->order_product_price,$order->order_currency_id); } ?> </td> <?php } ?> <!-- EO UNIT PRICE --> <!-- PRODUCT QUANTITY --> <td  class='price'> <?php echo $product->order_product_quantity;?> </td> <!-- EO PRODUCT QUANTITY --> <!-- TOTAL WEIGHT --> <?php if($total_weight) { ?> <td class='price'><?php echo rtrim(rtrim($product->order_product_weight*$product->order_product_quantity,'0'),',.').' '.\Joomla\CMS\Language\Text::_($product->order_product_weight_unit); ?></td><?php } ?> <!-- EO TOTAL WEIGHT --> <!-- TOTAL PRICE --> <?php if(!$this->shipping_invoice){ ?> <td  class='price'> <?php if($config->get('price_with_tax')){ echo $currencyHelper->format($product->order_product_total_price,$order->order_currency_id); }else{ echo $currencyHelper->format($product->order_product_total_price_no_vat,$order->order_currency_id); } ?> </td> <?php } ?> <!-- EO TOTAL PRICE --> </tr> <?php } ?> <?php if(!$this->shipping_invoice){ ?> <tr class='limitation'><td colspan='4'></td></tr> <tr class='order_end'> <!-- SUBTOTAL TITLE --> <td colspan='3' class='newarea'> <?php echo \Joomla\CMS\Language\Text::_( 'SUBTOTAL' ); ?> </td> <!-- EO SUBTOTAL TITLE --> <!-- SUBTOTAL --> <td  class='price'> <?php if($config->get('price_with_tax')){ echo $currencyHelper->format($order->order_subtotal,$order->order_currency_id); }else{ echo $currencyHelper->format($order->order_subtotal_no_vat,$order->order_currency_id); } ?> </td> <!-- EO SUBTOTAL --> </tr> <?php $taxes = $currencyHelper->round($order->order_subtotal - $order->order_subtotal_no_vat - $order->order_discount_tax + $order->order_shipping_tax + $order->order_payment_tax, $currencyHelper->getRounding($order->order_currency_id,true)); if(!empty($order->order_discount_code)){ ?> <tr class='order_end'> <!-- COUPON TITLE --> <td colspan='3' class='newarea'> <?php echo \Joomla\CMS\Language\Text::_( 'HIKASHOP_COUPON' ); ?> </td> <!-- EO COUPON TITLE --> <!-- COUPON --> <td  class='price'> <?php if($config->get('price_with_tax')){ echo $currencyHelper->format($order->order_discount_price*-1,$order->order_currency_id); }else{ echo $currencyHelper->format(($order->order_discount_price-@$order->order_discount_tax)*-1,$order->order_currency_id); } ?> </td> <!-- EO COUPON --> </tr> <?php } if(!empty($order->order_shipping_method)){ ?> <tr class='order_end'> <!-- SHIPPING TITLE --> <td colspan='3' class='newarea'> <?php echo \Joomla\CMS\Language\Text::_( 'SHIPPING' ); ?> </td> <!-- EO SHIPPING TITLE --> <!-- SHIPPING --> <td  class='price' > <?php if($config->get('price_with_tax')){ echo $currencyHelper->format($order->order_shipping_price,$order->order_currency_id); }else{ echo $currencyHelper->format($order->order_shipping_price-@$order->order_shipping_tax,$order->order_currency_id); } ?> </td> <!-- EO SHIPPING --> </tr> <?php } if(!empty($order->additional)) { $exclude_additionnal = explode(',', $config->get('order_additional_hide', '')); foreach($order->additional as $additional) { if(in_array(@$additional->order_product_name, $exclude_additionnal)) continue; ?> <tr> <!-- ADDITIONAL FEE TITLE --> <td colspan='3' class='newarea'><?php echo \Joomla\CMS\Language\Text::_($additional->order_product_name); ?></td> <!-- EO ADDITIONAL FEE TITLE --> <!-- ADDITIONAL FEE --> <td class='price'> <?php if(!empty($additional->order_product_price) || empty($additionaltionnal->order_product_options)) { if($config->get('price_with_tax')){ echo $currencyHelper->format($additional->order_product_price+@$additional->order_product_tax, $order->order_currency_id); }else{ echo $currencyHelper->format($additional->order_product_price, $order->order_currency_id); } } else { echo $additional->order_product_options; } ?> </td> <!-- EO ADDITIONAL FEE --> </tr> <?php } } if(!empty($order->order_payment_method) && $order->order_payment_price != 0){ ?> <tr class='order_end'> <!-- PAYMENT TITLE --> <td colspan='3' class='newarea'> <?php echo \Joomla\CMS\Language\Text::_( 'HIKASHOP_PAYMENT' ); ?> </td> <!-- EO PAYMENT TITLE --> <!-- PAYMENT --> <td class='price'><?php if($config->get('price_with_tax')) { echo $currencyHelper->format($order->order_payment_price, $order->order_currency_id); } else { echo $currencyHelper->format($order->order_payment_price - @$order->order_payment_tax, $order->order_currency_id); } ?></td> <!-- EO PAYMENT --> </tr> <?php } if($taxes > 0){ if($config->get('detailed_tax_display') && !empty($order->order_tax_info)){ foreach($order->order_tax_info as $tax){ ?> <tr class='order_end'> <!-- TAX TITLE --> <td colspan='3' class='newarea'> <?php if( function_exists('hikashop_translate')) echo hikashop_translate($tax->tax_namekey); else echo $tax->tax_namekey; ?> </td> <!-- EO TAX TITLE --> <!-- TAX --> <td  class='price'> <?php echo $currencyHelper->format($tax->tax_amount,$order->order_currency_id); ?> </td> <!-- EO TAX --> </tr> <?php } }else{ ?> <tr class='order_end'> <!-- VAT TITLE --> <td colspan='3' class='newarea'> <?php echo \Joomla\CMS\Language\Text::_( 'VAT' ); ?> </td> <!-- EO VAT TITLE --> <!-- VAT --> <td  class='price'> <?php echo $currencyHelper->format($taxes,$order->order_currency_id); ?> </td> <!-- EO VAT --> </tr> <?php } } ?> <tr class='total order_end'> <!-- TOTAL TITLE --> <td colspan='3' class='newarea'> <?php echo \Joomla\CMS\Language\Text::_( 'HIKASHOP_TOTAL' ); ?> </td> <!-- EO TOTAL TITLE --> <!-- TOTAL --> <td  class='price' > <?php echo $currencyHelper->format($order->order_full_price,$order->order_currency_id); ?> </td> <!-- EO TOTAL --> </tr> <?php } ?> </table> <div class='methods'> <p> <!-- SHIPPING METHOD --> <?php if (!empty($pluginsShipping)){ echo '<span>'.\Joomla\CMS\Language\Text::_('HIKASHOP_SHIPPING_METHOD').' </span>: '; if(is_string($order->order_shipping_method)) { if(strpos($order->order_shipping_id, '-') !== false) echo $shippingClass->getShippingName($order->order_shipping_method, $order->order_shipping_id); else echo $pluginsShipping->getName($order->order_shipping_method, $order->order_shipping_id); }else{ echo implode(', ', $order->order_shipping_method); } echo '<br/>'; } ?> <!-- EO SHIPPING METHOD --> <!-- PAYMENT METHOD --> <?php if(!empty($pluginsPayment)) echo '<span>'.\Joomla\CMS\Language\Text::_('HIKASHOP_PAYMENT_METHOD').' </span>: '.$pluginsPayment->getName($order->order_payment_method, $order->order_payment_id).'<br/>'; if($order_weight) { echo '<br/><span>'.\Joomla\CMS\Language\Text::_('HIKASHOP_TOTAL_ORDER_WEIGHT') . ' </span>: ' . rtrim(rtrim($order->order_weight,'0'),',.').' '.\Joomla\CMS\Language\Text::_($order->order_weight_unit); } $paymentClass = hikashop_get('class.payment'); $payment = $paymentClass->get($order->order_payment_id); if(!empty($payment->payment_params->information)) echo $payment->payment_params->information; ?> <!-- EO PAYMENT METHOD --> </p> </div> <page_footer> <div class='footer'> <!-- FOOTER --> <?php $name = $this->params->get('footer'); $trans = hikashop_translate($name); echo str_replace(array('\r\n','\n','\r'),array('<br/>','<br/>','<br/>'), $trans); ?> <!-- EO FOOTER --> </div> </page_footer> <br/> <?php if(hikashop_level(2) && !empty($fields['order'])){ ob_start(); foreach($fields['order'] as $fieldName => $oneExtraField) { if(!@$oneExtraField->field_frontcomp || empty($order->$fieldName)) continue; $oneExtraField->currentElement = $order; ?> <tr class='hikashop_order_custom_field_<?php echo $fieldName;?>_line'> <td class='key'> <?php echo $fieldsClass->getFieldName($oneExtraField);?> </td> <td> <?php echo $fieldsClass->show($oneExtraField,$order->$fieldName,'user_email'); ?> </td> </tr> <?php } $additionalInfo = ob_get_clean(); if(!empty($additionalInfo)){ ?> <div class='hikashop_order_custom_fields_fieldset'> <div class='legend'><?php echo \Joomla\CMS\Language\Text::_('ADDITIONAL_INFORMATION'); ?></div> <table class='hikashop_order_custom_fields_table adminlist' cellpadding='1' width='100%'> <?php echo $additionalInfo; ?> </table> </div> <br/> <?php } } \Joomla\CMS\Plugin\PluginHelper::importPlugin('hikashop'); \Joomla\CMS\Plugin\PluginHelper::importPlugin('hikashopshipping'); \Joomla\CMS\Plugin\PluginHelper::importPlugin('hikashoppayment'); $app = \Joomla\CMS\Factory::getApplication(); ob_start(); $mode = 'order_front_show'; if(hikashop_isClient('administrator')) $mode = 'order_back_invoice'; $app->triggerEvent('onAfterOrderProductsListingDisplay', array(&$order, $mode)); $html = ob_get_clean(); if(!empty($html)) { ?> <table class="hikashop_order_extra_table adminlist" cellpadding="1" width="100%"> <tr> <td><?php echo $html; ?></td> </tr> </table> <?php } ?> </page>
If, for example, I update the plugin today to the latest version, 5.2.9, the template will be overwritten again.
How can I lock my customisations so that they aren’t overwritten by an update, or: How can I create a new template so that it is also available in the plugin settings?

Please Log in or Create an account to join the conversation.

Time to create page: 0.092 seconds
Powered by Kunena Forum