Translation of the notification of when adding a product to the shopping cart

  • Posts: 127
  • Thank you received: 3
4 years 6 months ago #319249

-- url of the page with the problem -- : www.abierto.uy
-- HikaShop version -- : 4.3.0
-- Joomla version -- : 3.9.18

Hello

I need to translate the message text when a product is added to the shopping cart. I have verified the translation files and the translation is correct in the Spanish language file, I have even changed the label of the English idiona file to Spanish, but the text continues showing in English.
Will the text be coded in the code?

Thank you !

Attachments:

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

  • Posts: 82867
  • Thank you received: 13373
  • MODERATOR
4 years 6 months ago #319252

Hi,

The issue is that you have added some javascript code on your pages which generates a javascript error when the page is loaded:

$("a.hikacart").on("click",function(){
	//Evento a colocar en Botones 'Añadir a tu pedido'
	gtag('event', 'añadir_carrito', {'event_category' : 'engagement','event_label' : 'añadir_carrito'});
});
monosnap.com/file/hjjuDNUc29ANI1Z4CVEBf6tFT7C0AX
monosnap.com/file/IJIFMzQb4cVf6N8QrCbB60mkcTj20T
That error apparently happens because of a jquery conflict.

Because of that, the javascript code to initialize the messages of the cart notification box is not run by the browser (you can see it just after your code, with your translations), and thus the system falls back to the English translation which is hard coded as a fallback mechanism when there is a javascript error on the page.

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

  • Posts: 127
  • Thank you received: 3
4 years 6 months ago #319300

Hello, thanks for the answer

If I understand perfectly, this is related to another post that I have published here.
I need to configure the events for google analytics, to be able to track the clicks that the user makes on the site, how many they buy after adding the products to the shopping cart, where in the buying process they leave, etc.

Maybe you can tell me in which file is the code for the "add to cart" button, and in this way integrate the JS code for analytics into it.

Thank you !

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

  • Posts: 82867
  • Thank you received: 13373
  • MODERATOR
4 years 6 months ago #319303

Hi,

The JS code for the add to cart buttons is in media/com_hikashop/hikashop.js in the "addToCart" function.

However, the best is to do it like that:

if(window.Oby) {
window.Oby.registerAjax(["cart.updated"],function(params){
 gtag('event', 'añadir_carrito', {'event_category' : 'engagement','event_label' : 'añadir_carrito'});
});
}
That way, you'll trigger the Google Analytics event without even needing jQuery. And what's even better is that it will only trigger if the add to cart process works. If it doesn't, because the customer is asking to add more quantity in the cart than what's available in the stock for example, it won't trigger the event.

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

  • Posts: 127
  • Thank you received: 3
4 years 6 months ago #319341

Hello, thanks for the answer

Perfect, that is a great help for me. But given my little experience with JS, I make you one more query, this code that you send me, I add it in media/com_hikashop/hikashop.js in the "addToCart" function or as a new function independently?

Thank you !

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

  • Posts: 82867
  • Thank you received: 13373
  • MODERATOR
4 years 6 months ago #319347

Hi,

No, you want to add it elsewhere. Where you had added your previous code for example.

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

  • Posts: 127
  • Thank you received: 3
4 years 6 months ago #319491

Hello, the tracking of the "add to cart" button works perfectly.

Many thanks, greetings!

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

Time to create page: 0.069 seconds
Powered by Kunena Forum