VirtueMart Forum

VirtueMart 2 + 3 + 4 => Language/Translations => Topic started by: six gun on September 04, 2018, 05:02:33 AM

Title: Add to cart popup not appearing in French in multi-lingual shop
Post by: six gun on September 04, 2018, 05:02:33 AM
I have a multilingual site. English, German French and Spanish.
I have just noticed there is a problem with the add to cart popup in French.
With the other languages on clicking the add to cart the popup appears. With French there is a momentary spinning image and then nothing. The item does not appear in the mini cart until the page refreshes.
I presume there is a configuration error - something not configured in French.
https://www.c60inoliveoil.com/fr/boutique/c60-dans-l-huile-de-chanvre/c60-dans-l-huile-de-chanvre-vierge-detail
Any suggestions much appreciated.
Title: Re: Add to cart popup not appearing in French in multi-lingual shop
Post by: Jörgen on September 04, 2018, 08:01:58 AM
Have You tried turning off sef and see what happens ?
Are there some taxes that are different for buying product in french ?
It is your template vp_smart that fails in js, vmprices.js, data is null

regards

Jörgen @ Kreativ Fotografi
Title: Re: Add to cart popup not appearing in French in multi-lingual shop
Post by: GJC Web Design on September 04, 2018, 10:32:30 AM
TypeError: data is null[Learn More] vmprices.js:174:1
   Virtuemart.renderDialog https://www.c60inoliveoil.com/templates/vp_smart/js/vmprices.js:174:1
   success https://www.c60inoliveoil.com/templates/vp_smart/js/vmprices.js:160:5
   i https://www.c60inoliveoil.com/media/jui/js/jquery.min.js:2:27444
   fireWith https://www.c60inoliveoil.com/media/jui/js/jquery.min.js:2:28213
   y https://www.c60inoliveoil.com/media/jui/js/jquery.min.js:4:22719
   c https://www.c60inoliveoil.com/media/jui/js/jquery.min.js:4:26925

Virtuemart.renderDialog = function(data, textStatus) {
   var $ = jQuery.noConflict();
   if ($.type(data.msg) == 'string') {
      data.msg = $.parseHTML(data.msg);
   }

seems data.msg is empty - think it comes from the cart helper ajax addto function

is the lang var set etc?
Title: Re: Add to cart popup not appearing in French in multi-lingual shop
Post by: six gun on September 04, 2018, 11:24:05 AM
Quote from: Jörgen on September 04, 2018, 08:01:58 AM
Have You tried turning off sef and see what happens ?
Are there some taxes that are different for buying product in french ?
It is your template vp_smart that fails in js, vmprices.js, data is null

regards

Jörgen @ Kreativ Fotografi

i turned off SEF in Joomla global configuration - still has the same issue. i remember sh404SEF caused an issue with the popup where it would not translate and when i took it off the site the translation worked fine.
No different taxes for France.
i am travelling at the moment and not in a position to fully take in what you and GJC are suggesting.
Many thanks for the prompt response.
Title: Re: Add to cart popup not appearing in French in multi-lingual shop
Post by: GJC Web Design on September 04, 2018, 11:47:13 AM
you certainly don't need anything like sh404 on any J3/VM3 sites .. they handle SEF natively
Title: Re: Add to cart popup not appearing in French in multi-lingual shop
Post by: Studio 42 on September 04, 2018, 14:00:57 PM
First disable sh404 and use Joomla core SEF.
Add a home link for each language for root and virtuemart, if it's not the case.
(the english shop language switch dont have right template set)
Activate the PHP error log, so you can see if something is wrong in french only.
Title: Re: Add to cart popup not appearing in French in multi-lingual shop
Post by: six gun on September 07, 2018, 04:59:22 AM
I used deductive reasoning.
The problem was only in French and it was to do with the virtuemart functions.
What is different between the languages?
The language files.
I tracked it down to the fr-FR.com_virtuemart.ini file.
When i deleted this file and the site fell back onto the English file there was no problem.
So i went through the English file on the server, line by line translating it into French and then checking if the popup kept working.
At line 87 in my French file we had COM_VIRTUEMART_CART_PRODUCT_ADDED="%2$s x %1$s a été ajouté à votre panier."
when this replaced the same line in English the problem arose. COM_VIRTUEMART_CART_PRODUCT_ADDED="%2$s x %1$s was added to your cart."
So there was something in [a été ajouté à votre panier.]
i switched back and forth between the English and the French - it was that line.
Anyway i then found a recently translated fr-FR.com_virtuemart.ini and put that in - it worked.
i had got a bad ini file from somewhere and it stopped the popup working.
Strange but true.
Title: Re: Add to cart popup not appearing in French in multi-lingual shop
Post by: Jörgen on September 07, 2018, 07:40:20 AM
Sounds that it may have something to do with the coding coding of the language file. Was it ANSI instead of UTF-8 perhaps ? I have seen strange things happen because of this, but usually more harmless than this issue.

Glad that You got it working.

Jörgen @ Kreativ Fotografi
Title: Re: Add to cart popup not appearing in French in multi-lingual shop
Post by: Studio 42 on September 07, 2018, 10:12:21 AM
YOu can check on activating Joomla language debug in the back-end. You see then all errors in the ini file.
I had already similar problems on a website with 5 or 6 languages, but never stopped the add to cart, but because add to cart is a json request, if the file is not UTF-8 encoded then you can have an encoding error, because json need UTF-8, especialy if the json format is not specified right in the request.
Title: Re: Add to cart popup not appearing in French in multi-lingual shop
Post by: six gun on September 07, 2018, 13:28:21 PM
Yes i wondered about the ANSI instead of UTF-8. i copied and pasted into Notepad++ and saved the file on the desktop FTP'ing it onto the server after changes. It was very late when i finally got the problem sorted so i did not go into too much details once it was. i suspect it was a file i had picked up that was ANSI. There were other lines which when i copy pasted the French text into the server file nothing appeared on the page. When i used ini files currently on the Virtuemart language download page everything worked fine.
Many thanks for the comments and advice.
Title: Re: Add to cart popup not appearing in French in multi-lingual shop
Post by: GJC Web Design on September 07, 2018, 22:51:14 PM
see above

QuoteVirtuemart.renderDialog = function(data, textStatus) {
   var $ = jQuery.noConflict();
   if ($.type(data.msg) == 'string') {
      data.msg = $.parseHTML(data.msg);
   }

seems data.msg is empty - think it comes from the cart helper ajax addto function

is the lang var set etc?

if the lang var failed because of encoding this would throw the above error and stop the cart JS