HikaShop Translation Issues for Notification E-mail & PDF Invoice

  • Posts: 20
  • Thank you received: 1
5 years 6 months ago #297318

-- HikaShop version -- : 3.5.1 Essential
-- Joomla version -- : 3.8.11
-- PHP version -- : 7.0.30
-- Browser(s) name and version -- : Firefox Quantum 61.0.2

Derar HikaShop Team,

I am working on a test site that has English (the default language) and the German language installed. I also have Falang Standard installed for translations. I have also edited the views file for my template (checkout / cart.php) on lines 443 and 445:

<?php echo $tax->tax_namekey; ?>
to
<?php echo JText::_($tax->tax_namekey); ?>

As you know this allows the tax namekey to be translated using the language overrides. I use the language constant override TAXEU with the values “Sales Tax” & “MwST,” which are given both site/administrator locations. In the front end this works fine:



But in the back end under the “Additional Information” section for the product, in the notification e-mail and on the PDF invoice, the TAXEU language constant appears instead of its value:



I have tried putting the TAXEU language constant in the place of TAX in the invoice.php file for the PDF invoice, but this makes no difference. Is it possible to have the TAXEU language constant display its values, as it does on the website checkout page?

2. I have a virtual product with pdf files and in the notification e-mail the links are displayed following a confirmed order. This displays and works as it should when an order is made in English, but if the order is made in German, the links to the English pdf files are displayed instead of the German pdf files links! The translation for the links have been completed and published in Falang:



In the front end, if user accesses their account in the English or German language, the files for the different languages can be downloaded:



Additionally, if the files were free they can also be downloaded in the language selected by the user, so this works as it should. The only issue is in the confirmed e-mail notification.

3. The payment and shipping methods are translated and published in Falang and appear as they should be on the checkout page (Bank Transfer/ Banküberweisung and Standard UK Delivery/ Standard UK Lieferung), in the front end, and in the “created” e-mail notification. However, the translation into German is not shown in the “confirmed” e-mail notification, the PDF invoice or in the back end section “Zusätzliche Informationen” for the product:



Not sure why this happens only with a confirmed order e-mail and onwards.

4. Is it possible to have the date on the German PDF invoice in a DD-MM-YYYY format? As this is the format used on the English PDF invoice. Also, in the PDF Invoice plugin there is a setting that allows text to be inserted at the footer of the PDF invoice, but this would only work for one language:



I noticed a language constant : PDF_INVOICE_FOOTER, in the hikashop language file. Can this be used in the invoice.php file to display translated text instead of using the plugin’s configuration? I did put language constant PDF_INVOICE_FOOTER into the invoice.php file, but nothing is displayed on the PDF invoice.

Do I need the latest PDF Invoice plugin, if there is one? I bought and downloaded it 3 years ago and I am not sure if it is updated with HikaShop updates or separately.

I hope the above issues I have brought up can be resolved.

Regards,

Mr B

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

  • Posts: 81361
  • Thank you received: 13037
  • MODERATOR
5 years 6 months ago #297341

Hi,

1. Well you would have to edit all the other views and the preload of the emails to change the display of the tax namekey similarily to the checkout. The best is to search the text "tax_namekey" in all the files of the website and if you have a echo at the beginning of the line where you have a match, then you can add the JText::_ call.
Actually, next version of HikaShop will have these changes made so if you wait for next version, you won't have anything to do.

2. I don't think that you have an issue here. You have to remember that Falang only translates stuff on the frontend. If you change the status of an order in the backend, then the email will be generated in the backend, and thus, the file won't be translated by Falang. However, normally, the orders are automatically confirmed by the payment gateway through the frontend of the website, so normally, the files should be in the correct language.
If you also need to have the files in the correct language from the backend because for example you're accepting "bank transfer" payments and thus you need to manually confirm some of the orders, then in that case, I would recommend to simply have both files in the product, regardless of the language. So someone buying will be able to see the file in both languages.

3. It's the same problem as pointed in 2.

4. You have these translation strings that you can override in order to change the date format based on the language:
HIKASHOP_DATE_FORMAT="%Y-%m-%d"
HIKASHOP_EXTENDED_DATE_FORMAT="%Y-%m-%d %H:%M"

Regarding the footer, we didn't add any code to be able to translate it but that's a good idea, we'll add that.
What you can do is replace the code:

<?php echo str_replace(array("\r\n","\n","\r"),array('<br/>','<br/>','<br/>'),$this->params->get('footer')); ?>
to:
<?php
		$name = $this->params->get('footer');
		$val = strtoupper($name);
		$trans = JText::_($val);
		if($val == $trans)
			$trans = $name;
		echo str_replace(array("\r\n","\n","\r"),array('<br/>','<br/>','<br/>'), $trans); ?>
in the file plugins/hikashop/attachinvoice/attachinvoice/invoice.php to be able to do what you want.
We'll add that on our end for future versions of the plugin.
Note that the updates are not done automatically for the plugin. So you would have to download it again on our website and install it on yours to get all the improvements. Note alos that we give 3 years of download for plugins purchased on our website, after which you would have to purchase it again to get access to new versions again.
But for the invoice plugin, nothing much changed in it, so if it still works fine for your needs, I don't see a reason to update it.

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

  • Posts: 20
  • Thank you received: 1
5 years 6 months ago #297461

Hello Nicolas,

Thanks for your reply and the solutions you have offered for the post above.

1. If there is a development in HikaShop 3.5.2 to allow the tax namekey to have its assigned value appear universally, then that is good and I can wait for that. Would this mean removing the edits from the view? If so, how would HikaShop recognise a language constant from just a normal tax namekey?

2 & 3. I can understand that using to two pdf files, in different languages, for one product makes sense, as this method is used by some applications that offer multilingual documents. However, there is a flaw in HikaShop that makes your suggestion impractical. Because you said that a confirming an order manually, in the back end, is not translated, I realise that any content element for translation in Falang under “HikaShop Files” produces the same problem.

For example, I have 2 product images one with English text and one with German text, an order created in the front end using the German language, displays the German language image in the notification e-mail for a created order. However, a confirmed order, done manually from the back end (even if I am logged in to the back end with the German language), displays the English language image on the confirmed order notification e-mail. I would assume your solution for this would be to put both English and German text on the product image, but this is not practical, because thats what the translating facility is for.

Furthermore, if you say that Falang only translates content in the front end, then the product’s title/description should also appear in just English when an order is confirmed manually in the back end and a notification e-mail is sent, but it does not (see confirmed e-mail above.) Content elements under “HikaShop Products” have their titles/descriptions translated through the whole process using the Bank Transfer method from creation, to confirmation and to PDF Invoice. Why does this translation not happen for HikaShop Files, HikaShop Payment Methods and HikaShop Shipping Methods content elements in Falang?

I noticed in the Falang component: administrator > components > com_falang > contentelements that there is a PHP file for HikaShop products and I wonder if this allows a product’s name/description to be displayed consistently in the language the order was made in, for a manually confirmed order notification e-mail and the PDF Invoice. If this is the case, could something be done for HikaShop Files, HikaShop Payment Methods and HikaShop Shipping Methods content elements?

I believe, at least, if an order is confirmed in the back end when a website is multilingual, the language that is used (if German in my case) should produce a confirmed order notification e-mail and PDF invoice that is only in German, if all the translated elements are in place to allow this. I am sure this is something that the HikaShop team could enable if you wanted to and would make HikaShop completely multilingual concerning manually confirmed orders producing notification e-mails and PDF Invoices. This is what clients expect.

4. Changing the date format is obvious; I forgot that I had done it with the English language. Thanks for additional code to display the footer text on the PDF invoice. However, I believe there should be a language constant put somewhere. Could you tell me if the inclusion and syntax of the language constant PDF_INVOICE_FOOTER in the following is correct?

<?php
		$name = $this->params->get('footer');
		$val = strtoupper($name);
		$trans = JText::_('PDF_INVOICE_FOOTER'). ($val);
		if($val == $trans)
		$trans = $name;
		echo str_replace(array("\r\n","\n","\r"),array('<br/>','<br/>','<br/>'), $trans); ?>

Thanks for your continuing support.

Mr B.

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

  • Posts: 81361
  • Thank you received: 13037
  • MODERATOR
5 years 6 months ago #297523

Hi,

1. You don't need to remove the edits.
Next version will have similar changes. We'll check if a translation is available for the text of the namekey, if no, it will display the namekey, if yes, it will display the translation.

2. I do say that it is because Falang doesn't translate the content on the backend. That's a fact.
The fact that you have the product name in the correct language in the email is because when the order is created, a copy of the product name is made in the order so that even if the product is deleted in the future, the order will still have the name of the product, for reference. This means that it automatically has the translation the customer sees. So it's a special case.
The proper method to handle that would be to change the paradigm of the way the translations are made. The day we have translations handled directly in HikaShop, we'll be able to easily handle the translations in the emails of all the elements, regardless if the email is generated on the frontend or the backend.
With the way Falang works, the only solution I can propose to circumvent that problem is to use HikaMarket Front edition:
www.hikashop.com/extensions/hikamarket-front-end.html
With it, you can maange your shop from the frontend and you can confirm the orders from the frontend. In that case, Falang will be able to do its work on the elements of the email notifications for the orders you manual confirm.

4. No the code I gave is correct.
So in the footer setting of the plugin, you use the text MY_PDF_INVOICE_FOOTER, you can add a translation override like that:
MY_PDF_INVOICE_FOOTER="My footer"
And you'll see the text "My footer" as footer of the PDF invoices.
If no translation is found for the text of the setting, then it will display the text of the setting.

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

Time to create page: 0.080 seconds
Powered by Kunena Forum