- Posts: 637
- Thank you received: 26
Small suggestion regarding store address formatting in PDF invoice
4 months 1 week ago #371951
by Lumiga
Kind regards,
Lumiga
Hi,
First of all, thanks a lot for the PDF invoice plugin — it's been really helpful in my projects.
While customising the invoice template for one of my clients, I noticed something small that you might want to look into when you have a moment. The store address from the HikaShop configuration is printed on a single line in the generated PDF, even though the address in the config contains line breaks. Ideally those line breaks would show up on the invoice as well.
Looking at the code with AI in plugins/hikashop/attachinvoice/attachinvoice/invoice.php (around line 134), I think it might be related to this line:
$store = str_replace(array('\r\n','\n','\r'),array('<br/>','<br/>','<br/>'),$config->get('store_address',''));
If I'm reading it correctly (read AI
, the search strings are wrapped in single quotes, which in PHP means the \r and \n are interpreted as literal characters (backslash + letter) rather than actual newline characters. Since the address in the config contains real newlines, the replacement doesn't find a match.
First of all, thanks a lot for the PDF invoice plugin — it's been really helpful in my projects.
While customising the invoice template for one of my clients, I noticed something small that you might want to look into when you have a moment. The store address from the HikaShop configuration is printed on a single line in the generated PDF, even though the address in the config contains line breaks. Ideally those line breaks would show up on the invoice as well.
Looking at the code with AI in plugins/hikashop/attachinvoice/attachinvoice/invoice.php (around line 134), I think it might be related to this line:
$store = str_replace(array('\r\n','\n','\r'),array('<br/>','<br/>','<br/>'),$config->get('store_address',''));
If I'm reading it correctly (read AI
Kind regards,
Lumiga
Please Log in or Create an account to join the conversation.
4 months 6 days ago #371952
by nicolas
Replied by nicolas on topic Small suggestion regarding store address formatting in PDF invoice
Hi,
Thanks for the report. On our end the default invoice.php of the PDF invoice plugin already converts the store address line breaks correctly (it uses the right syntax), so we cannot reproduce the single line issue with a current version.
If you see single quotes there, you are most likely on a quite old version of the plugin, or on a customized / overridden invoice.php on that site. Could you check that the PDF invoice plugin is up to date, and if you have a custom invoice template, that its store address line matches the current default one?
Still, we've found that the issue is there for other invoice layouts of the plugin so we've made a new version for these following your feedback.
Thanks for the report. On our end the default invoice.php of the PDF invoice plugin already converts the store address line breaks correctly (it uses the right syntax), so we cannot reproduce the single line issue with a current version.
If you see single quotes there, you are most likely on a quite old version of the plugin, or on a customized / overridden invoice.php on that site. Could you check that the PDF invoice plugin is up to date, and if you have a custom invoice template, that its store address line matches the current default one?
Still, we've found that the issue is there for other invoice layouts of the plugin so we've made a new version for these following your feedback.
The following user(s) said Thank You: Lumiga
Please Log in or Create an account to join the conversation.
4 months 6 days ago #371963
by Lumiga
Kind regards,
Lumiga
Replied by Lumiga on topic Small suggestion regarding store address formatting in PDF invoice
Hi,
Yes you are right, I didn't used the invoice.php (that was a mistake from AI) in my case it was the corporate invoice.
Thanks a lot for the fix.
Kind regards,
Lumiga
Yes you are right, I didn't used the invoice.php (that was a mistake from AI) in my case it was the corporate invoice.
Thanks a lot for the fix.
Kind regards,
Lumiga
Kind regards,
Lumiga
The following user(s) said Thank You: nicolas
Please Log in or Create an account to join the conversation.
Time to create page: 0.210 seconds