2.2. Javascript alert messages wrong characters - javascript alert deactivation

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
Hello,

Some messages as "The maximum quantity allowed for purchase is {0}." are displayed twice. One time in HTML and one time in alert window.

But in the alert message, latin characters are not converted. Example in french
"La quantité maximale autorisée pour l'achat est de {0}" appears as below
"La quantité maximale autorisée pour l'achat est de 3"

This problem already existed in 1.9.

How we can deactivate javascript alerts or change the code ?
12 years ago
Follow the next steps:
1. Open \Views\Catalog\ProductTemplate.SingleVariant.cshtml file
2. Remove the following code:
@if (errors.Count > 0)
{
    var addToCartWarningsSb = new System.Text.StringBuilder();
    for (int i = 0; i < errors.Count; i++)
    {
        addToCartWarningsSb.Append(errors[i]);
        if (i != errors.Count - 1)
        {
            addToCartWarningsSb.Append("\\n");
        }
    }

    //display errors  
    <script type="text/javascript">
        $(document).ready(function () {
            alert('@addToCartWarningsSb.ToString()');
        });
    </script>
}

3. Repeat step 2 for \Views\Catalog\ProductTemplate.VariantsInGrid.cshtml FILE
12 years ago
Many thanks Andrei,

Right and fast answer as usual.

Would it be simple to add the alert during the update of the cart ?
12 years ago
Haven't got you. What update of the cart?
12 years ago
When updating qty in shopping cart, max and min qty are correctly checked but no alert occurs and no message is visible.

I think that the message displayed in product box when adding to shopping cart and qties are wrong shoud be displayed too in shopping cart when updating quantities. It is the reason of my question.

Regards
12 years ago
Fixed. Please see changeset 1370e82849b8
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.