pdf attach invoice layout problem

  • Posts: 350
  • Thank you received: 10
  • Hikashop Business
4 months 5 days ago #327970

-- 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?

Attachments:

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

  • Posts: 72738
  • Thank you received: 11090
  • MODERATOR
4 months 4 days ago #327974

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:

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:
$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.

  • Posts: 350
  • Thank you received: 10
  • Hikashop Business
4 months 4 days ago #327987

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.

  • Posts: 72738
  • Thank you received: 11090
  • MODERATOR
4 months 4 days ago #327988

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: michelpouli

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

  • Posts: 350
  • Thank you received: 10
  • Hikashop Business
4 months 3 days ago #328032

Yes, thank you, this works fine!

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

Time to create page: 0.061 seconds
Powered by Kunena Forum