Go to previous topic
Go to next topic
Last Post 22 Jan 2021 12:43 AM by  Albert Frausto
How to change error message language
 7 Replies
Author Messages


New Member


Posts:29
New Member


--
20 Jan 2021 06:55 PM

    Hello,

    We have set a min and max order quantity for all of our products but the message that displays when a user tries to add a product that they have already reached their max order quantity is a bit confusing. For example, in the shopping cart product pages, when you try to exceed the quantity restriction for a SKU by adding more to your cart than you are allowed, you are presented with an error that says “Product is not available. It's not clear if the product is out of stock or if the shopper has reached their quota. Is there a way to change this message to instead say something like  "You've reached the maximum quantity allowed for this product."

    Thanks

    0


    Veteran Member


    Posts:2957
    Veteran Member


    --
    21 Jan 2021 09:39 PM
    • Accepted Answer

    Hi Albert

    You can create a custom template for the Product Detail and find the line:

    @HttpUtility.JavaScriptStringEncode(Html.LocalizeString(Global.LocalizedStrings.Message_ProductNotAvailable, Global.FilePaths.LocalSharedResourceFile))"

    and replace with this to print the message returned:

    " + data.responseJSON.Message

    Then you can edit the static localization for the ValidationResult.resx file for the 3.Text entry.

    In the next release, we'll include the line changes available out of the box. 

    0


    New Member


    Posts:29
    New Member


    --
    21 Jan 2021 10:52 PM
    Hello Steve,

    Thank you for the solution.

    It appears that the forum editor has removed parts of the code from your post. Can you please repost the code again.

    Also, I searched the Product Detail template page for the line to be modified and there are appears to be two location. See screenshot, https://www.screencast.com/t/iIXbUwmyK6j. Are we suppose to update both lines?

    We appreciate your help with this.
    0


    Veteran Member


    Posts:2957
    Veteran Member


    --
    21 Jan 2021 11:03 PM
    Just look for the one contained inside the
    fail(function (data, textStatus, errorThrown) { ... }
    0


    Veteran Member


    Posts:2957
    Veteran Member


    --
    21 Jan 2021 11:04 PM
    The code did not cut off. It really is like the way I posted that you need to replace.
    0


    New Member


    Posts:29
    New Member


    --
    21 Jan 2021 11:09 PM
    I only mention that because the email notification I received was slightly different than the forum post. See screenshot, https://www.screencast.com/t/vRnGugV8Uz

    Thanks again for all your help.
    0


    Veteran Member


    Posts:2957
    Veteran Member


    --
    21 Jan 2021 11:11 PM

    OH I see. That was my fault. I posted the code and modified it later on when I realized it's too hard to follow and yes occasionally knowing the forum breaks a long code. But the one that is posted here is correct.

    :)

    0


    New Member


    Posts:29
    New Member


    --
    22 Jan 2021 12:43 AM
    In case someone else reads this. I had to repeat the same steps for the Product List template.
    0


    ---