Healthy Theme - Shopping Cart - Estimate shipping gives error : anti-forgery cookie The required anti-forgery cookie "__RequestVerificationToken" is n

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

We are using nopcommerce version 3.7 and Theme is "Healthy" from "n-theme.com".

When we apply this theme it gives us below error, in cart when click on "Estimate Shipping" button.

The required anti-forgery cookie "__RequestVerificationToken" is not present.

Can someone help us resolve this error?
7 years ago
below is the code for EstimateShipping.cshtml for "Healthy" Theme.

@model EstimateShippingModel
@using Nop.Web.Models.ShoppingCart;
@if (Model.Enabled)
{
    <div class="shipping">
        <script type="text/javascript">
            $(function() {
                $("#@Html.FieldIdFor(model => model.CountryId)").change(function() {
                    var selectedItem = $(this).val();
                    var ddlStates = $("#@Html.FieldIdFor(model => model.StateProvinceId)");
                    var estimateProgress = $("#estimate-shipping-loading-progress");
                    estimateProgress.show();
                    $.ajax({
                        cache: false,
                        type: "GET",
                        url: "@(Url.RouteUrl("GetStatesByCountryId"))",
                        data: { "countryId": selectedItem, "addSelectStateItem": "false" },
                        success: function(data) {
                            ddlStates.html('');
                            $.each(data, function(id, option) {
                                ddlStates.append($('<option></option>').val(option.id).html(option.name));
                            });
                            estimateProgress.hide();
                        },
                        error: function(xhr, ajaxOptions, thrownError) {
                            alert('Failed to retrieve states.');
                            estimateProgress.hide();
                        }
                    });
                });
            });
        </script>

        <div class="estimate-shipping">
            <div class="title">
                <strong>@T("ShoppingCart.EstimateShipping")</strong>
            </div>
            <div class="hint">@T("ShoppingCart.EstimateShipping.Tooltip")</div>
            <div class="shipping-options">
                <div class="inputs">
                    @Html.LabelFor(model => model.CountryId, new { }, ":")
                    @Html.DropDownListFor(model => model.CountryId, Model.AvailableCountries, new { @class = "country-input" })
                    <span class="required">*</span>
                </div>
                <div class="inputs">
                    @Html.LabelFor(model => model.StateProvinceId, new { }, ":")
                    @Html.DropDownListFor(model => model.StateProvinceId, Model.AvailableStates, new { @class = "state-input" })
                    <span id="estimate-shipping-loading-progress" style="display: none;" class="please-wait">@T("Common.Wait...")</span>
                </div>
                <div class="inputs">
                    @Html.LabelFor(model => model.ZipPostalCode, new { }, ":")
                    @Html.TextBoxFor(model => model.ZipPostalCode, new { @class = "zip-input" })
                </div>
                <div class="buttons">
                    <input type="submit" name="estimateshipping" value="@T("ShoppingCart.EstimateShipping.Button")" class="button-2 estimate-shipping-button" />
                </div>
            </div>
            @if (Model.ShippingOptions.Count > 0)
            {
                <ul class="shipping-results">
                    @foreach (var shippingOption in Model.ShippingOptions)
                    {
                        <li class="shipping-option-item">
                            <strong class="option-name">
                                @T("ShoppingCart.EstimateShipping.ShippingOptionWithRate", shippingOption.Name, shippingOption.Price)
                            </strong>
                            <span class="option-description">
                                @Html.Raw(shippingOption.Description)
                            </span>
                        </li>
                    }
                </ul>
            }
            else if (Model.Warnings.Count > 0)
            {
                <div class="message-error">
                    <ul>
                        @foreach (var error in Model.Warnings)
                        {
                            <li>@error</li>
                        }
                    </ul>
                </div>
            }
        </div>
    </div>
}
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.