Skip to main content

pdf attach invoice layout problem

More
5 years 8 months ago #327970 by jouwnaambord.nl
-- HikaShop version -- : 4.4.0
-- Joomla version -- : 3.9.23
-- PHP version -- : 7.4

Hi,

I just purchased the latest attach pdf invoice plugin. For some products (or options) the textline is longer. This breaks the pdf layout, see screenshot. In the "old" plugin I didn't have that problem. How can I solve this?

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

More
5 years 8 months ago #327974 by nicolas
Hi,

From what I can see, the issue comes from the name of the option which is too long.
There is already code to avoid that for the product name, but there is indeed no code to handle that for options.
However, that was never the case, so you must have had the same issue before but never noticed.
To fix that, change the code:
Code:
echo $optionElement->order_product_name; if($optionElement->order_product_price>0 && !$this->shipping_invoice){ if($config->get('price_with_tax')){ echo ' ( + '.$currencyHelper->format($optionElement->order_product_price+$optionElement->order_product_tax,$order->order_currency_id).' )'; }else{ echo ' ( + '.$currencyHelper->format($optionElement->order_product_price,$order->order_currency_id).' )'; } }
to:
Code:
$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));
in the file plugins/hikashop/attachinvoice/attachinvoice/invoice.php

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

More
5 years 8 months ago #327987 by jouwnaambord.nl
Hi Nicolas,

Thanks for your solution. There must be some small mistake in the code, after changing I get the errormessage: "1 Tags are closed in a wrong order for [td]"

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

More
5 years 8 months ago #327988 by nicolas
Hi,

Ah yes, the line :
echo '<p>'.implode('<br/>', $this->str_split_unicode(strip_tags($option_name),50));
should be:
echo '<p>'.implode('<br/>', $this->str_split_unicode(strip_tags($option_name),50)).'</p>';
The following user(s) said Thank You: jouwnaambord.nl

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

More
5 years 8 months ago #328032 by jouwnaambord.nl
Yes, thank you, this works fine!

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

Time to create page: 0.195 seconds
Powered by Kunena Forum