PDF Invoice: Template changed, how to lock changes in case of updates
3 weeks 7 hours 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:
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?
-- 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; ?> | <?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> <?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>
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.
3 weeks 4 hours ago #100000272
by nicolas
Replied by nicolas on topic PDF Invoice: Template changed, how to lock changes in case of updates
You don't need to create a new template: the plugin has a layout override system. If a file with the same name as the selected layout exists in the folder media/com_hikashop/plugins/ of your site (here media/com_hikashop/plugins/flat_invoice.php), the plugin uses it instead of the one inside the plugin. Updating the plugin never touches that folder, so your customisation survives updates.
The simplest way is the editor in the back-end: in the plugin's settings, the link "You can edit the PDF layouts here" (below the Invoice layout field) opens the PDF layouts editor. Saving your modified flat_invoice there creates the override in media/com_hikashop/plugins/. You can also upload your edited flat_invoice.php by FTP to media/com_hikashop/plugins/ yourself.
Where you edited the file matters: the copy in plugins/hikashop/attachinvoice/attachinvoice/ is replaced at each update, so move your modified file to the media folder now, before updating to 5.2.9. After updating, compare your override with the new flat_invoice.php from the plugin, because an override does not receive the plugin's new features or fixes (for example the new data the layouts use) automatically.
Plugin page: www.hikashop.com/marketplace/product/18-plugin-pdf.html
The simplest way is the editor in the back-end: in the plugin's settings, the link "You can edit the PDF layouts here" (below the Invoice layout field) opens the PDF layouts editor. Saving your modified flat_invoice there creates the override in media/com_hikashop/plugins/. You can also upload your edited flat_invoice.php by FTP to media/com_hikashop/plugins/ yourself.
Where you edited the file matters: the copy in plugins/hikashop/attachinvoice/attachinvoice/ is replaced at each update, so move your modified file to the media folder now, before updating to 5.2.9. After updating, compare your override with the new flat_invoice.php from the plugin, because an override does not receive the plugin's new features or fixes (for example the new data the layouts use) automatically.
Plugin page: www.hikashop.com/marketplace/product/18-plugin-pdf.html
The following user(s) said Thank You: P.M.
Please Log in or Create an account to join the conversation.
3 weeks 3 hours ago - 3 weeks 1 hour ago #100000274
by P.M.
Replied by P.M. on topic PDF Invoice: Template changed, how to lock changes in case of updates
Good evening, Nicolas,
I’m completely at a loss. Today I updated to the latest version (5.2.9) – I’d previously had 5.1.0 installed.
I’d made a point of backing up the PHP scripts from the backend editor beforehand, because I’d encountered the problem before where everything was simply overwritten. Back then, I had to rebuild everything from scratch.
Today, even though I made the changes via the backend as shown in the attached image and the data is stored under `media/com_hikashop/plugins`, I carried out an update and the templates were reset to their default settings.
That’s why I’ve posted here today. Well, I now have a backup of my invoice template and will check during the next update whether it works and whether my template is retained.
Thank you for your explanations!
image missing https://i.imgur.com/gUygEKR.png
I’m completely at a loss. Today I updated to the latest version (5.2.9) – I’d previously had 5.1.0 installed.
I’d made a point of backing up the PHP scripts from the backend editor beforehand, because I’d encountered the problem before where everything was simply overwritten. Back then, I had to rebuild everything from scratch.
Today, even though I made the changes via the backend as shown in the attached image and the data is stored under `media/com_hikashop/plugins`, I carried out an update and the templates were reset to their default settings.
That’s why I’ve posted here today. Well, I now have a backup of my invoice template and will check during the next update whether it works and whether my template is retained.
Thank you for your explanations!
image missing https://i.imgur.com/gUygEKR.png
Last edit: 3 weeks 1 hour ago by P.M..
Please Log in or Create an account to join the conversation.
2 weeks 6 days ago #100000276
by nicolas
Replied by nicolas on topic PDF Invoice: Template changed, how to lock changes in case of updates
I tested exactly your case: a test shop on Joomla 6.2 with the PDF invoice plugin 5.1.0, flat_invoice modified and saved in the PDF layouts editor (which writes media/com_hikashop/plugins/flat_invoice.php), then the plugin updated to the latest version, then HikaShop itself reinstalled over it. After each update the modified flat_invoice.php was still in media/com_hikashop/plugins/ and the editor still showed my changes. So neither the plugin update nor the HikaShop update removes or resets that file, and nothing in the plugin's or HikaShop's install deletes files in that folder.
So something else made your invoice come out with the default layout after the update. Could you check these three things on your site and tell me what you find?
1. Display > Views, with the type filter on pdf_layout: the flat_invoice line should show a "Remove customization" link. If it does not, the file is not in media/com_hikashop/plugins/ under that exact name.
2. By FTP, the folder media/com_hikashop/plugins/: which files are in it, with their dates. The file must be named exactly like the layout selected in the plugin (flat_invoice.php). If you saved it in the editor with the "duplicate" option, it got another name (for example flat_something.php), and the plugin does not use it.
3. In the plugin's settings, the "Invoice layout" setting: it should still be on the Flat layout. Your override only replaces the layout that is selected there.
Your earlier experience, where everything was lost, matches changes made in the plugin's own folder (plugins/hikashop/attachinvoice/attachinvoice/), which is replaced at each update. The copy in media/com_hikashop/plugins/ is the one that survives.
About creating a new layout that appears in the plugin's settings: that list is fixed (Default, Flat, Corporate, Grid), so a new file would not appear in it. Keeping your modified flat_invoice.php as an override in media/com_hikashop/plugins/ and selecting Flat in the plugin is the intended way, and it is what survives updates. Keeping your backup copy, as you did, is still a good idea, and after an update it is worth comparing your file with the new flat_invoice.php of the plugin to pick up its fixes.
So something else made your invoice come out with the default layout after the update. Could you check these three things on your site and tell me what you find?
1. Display > Views, with the type filter on pdf_layout: the flat_invoice line should show a "Remove customization" link. If it does not, the file is not in media/com_hikashop/plugins/ under that exact name.
2. By FTP, the folder media/com_hikashop/plugins/: which files are in it, with their dates. The file must be named exactly like the layout selected in the plugin (flat_invoice.php). If you saved it in the editor with the "duplicate" option, it got another name (for example flat_something.php), and the plugin does not use it.
3. In the plugin's settings, the "Invoice layout" setting: it should still be on the Flat layout. Your override only replaces the layout that is selected there.
Your earlier experience, where everything was lost, matches changes made in the plugin's own folder (plugins/hikashop/attachinvoice/attachinvoice/), which is replaced at each update. The copy in media/com_hikashop/plugins/ is the one that survives.
About creating a new layout that appears in the plugin's settings: that list is fixed (Default, Flat, Corporate, Grid), so a new file would not appear in it. Keeping your modified flat_invoice.php as an override in media/com_hikashop/plugins/ and selecting Flat in the plugin is the intended way, and it is what survives updates. Keeping your backup copy, as you did, is still a good idea, and after an update it is worth comparing your file with the new flat_invoice.php of the plugin to pick up its fixes.
The following user(s) said Thank You: P.M.
Please Log in or Create an account to join the conversation.
2 weeks 6 days ago #100000283
by P.M.
Replied by P.M. on topic PDF Invoice: Template changed, how to lock changes in case of updates
The update to 5.2.11 worked.
The following user(s) said Thank You: nicolas
Please Log in or Create an account to join the conversation.
Time to create page: 0.309 seconds