The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Custom language error script breaks side cart function

PhilippePhilippe Member

The custom language error script you developed for us earlier seems to break the sidecart function. Not sure what has changed.

Jus to refresh memory, in multi-language situations, the error message that appears once one has emptied the cart or the side cart (via "remove item") , can not be translated in the custom language files. Instead you proposed the script below, which seems to break the sidecart operation (goes straight to full cart) , in our multi locale / multi currency implementation at Any idea what is going on?

// include in custom header
function errorTranslate() {
var cart_empty_en = "Your shopping cart is empty. Click here to return to the store.";
var cart_empty_trans = cart_empty_en;
var lang = '';
if (FC.json.custom_fields.hasOwnProperty("h:lang")) {
lang = FC.json.custom_fields["h:lang"].value;
if (FC.json.custom_fields.hasOwnProperty("lang")) {
lang = FC.json.custom_fields.lang;
if (lang != '') {
if (lang == "fr" || lang == "FR") {
cart_empty_trans = "Votre panier est vide. Cliquez ici pour revenir à la boutique.";
} else if (lang == "de" || lang == "DE") {
cart_empty_trans = "Ihr Einkaufswagen ist leer. Klicken Sie hier, um in den Laden zurück.";
$('.fc-messages a:contains("'+ cart_empty_en +'")').html(cart_empty_trans);
FC.client.on('render.done', errorTranslate);
  • fc_adamfc_adam FoxyCart Team

    Would it be possible to confirm a URL we could see it happening? I tried to replicate but wasn't able to.
  • I can set up a url on one of our test stores where the script is present and breaks the cart; however in hte process of doing so, I discovered that we have rendered the point moot due to the concurrent implementation of multi-currency.

    Indeed, you may remember that to force the cart to re-read the locale when something is changed in the cart (and thus to adjust the currency, empty the cart of existing items if the locale has changed , etc) , we have forced a full page refresh every time something changes in the cart.

    As a result, when the cart is emptied of the last item, we refresh the whole page, and re-read the h:lang info and the load the proper language string. Hence, I can just remove the script and everything works like a charm.

    If you want to debug the script for toehr clients, however, please let me know and I will set something up on one of our test stores
  • fc_adamfc_adam FoxyCart Team

    If that works ok for you, then that's great. We're getting closer to having our native multilingual solution which will negate the need for all of this, hopefully we can get that out there for you soon!
  • PhilippePhilippe Member
    edited July 2016
    What about adjusting the translations - some of your current ones were approximative :-) (French), or inexistent (Italian) - Is it done via the config panel like when currently adjusting translations for the default locale ?
  • fc_adamfc_adam FoxyCart Team
    @Philippe, when the new feature launches, it will use the native translations we have, and you'll be able to set up custom language string customisations per language you support as well, just like you can now with the single language selection.
Sign In or Register to comment.