Beispiel #1
0
    private void PopulateShippingMethods()
    {
        IEnumerable <IShippingMethod> shippingMethods = this.Model.ShippingMethods;
        var customer = AspDotNetStorefrontCore.Customer.Current;

        if (!customer.HasAtLeastOneAddress() ||
            (string.IsNullOrEmpty(customer.PrimaryShippingAddress.City) &&
             string.IsNullOrEmpty(customer.PrimaryShippingAddress.State) &&
             string.IsNullOrEmpty(customer.PrimaryShippingAddress.Country)))
        {
            ShowError(StringResourceProvider.GetString("smartcheckout.aspx.153"));
            ShippingMethods.Items.Clear();
            this.Disable();
            return;
        }

        if (shippingMethods.Count() <= 0)
        {
            if (!string.IsNullOrEmpty(this.Model.LastShippingMethodError))
            {
                if (AppLogic.AppConfigBool("Vortx.OnePageCheckout.AllowRTShipping.NoMethodSelected"))
                {
                    ShowError(StringResourceProvider.GetString("smartcheckout.aspx.165"));
                }
                else
                {
                    ShowError(this.Model.LastShippingMethodError);
                }
            }
            else
            {
                ShowError(StringResourceProvider.GetString("smartcheckout.aspx.131"));
            }
            ShippingMethods.Items.Clear();
            this.Disable();
            return;
        }

        if (CartContentsChanged && shippingMethods.Count() > 0)
        {
            ShowErrorWithCss(StringResourceProvider.GetString("smartcheckout.aspx.166"), "error-wrap");
        }
        else
        {
            PanelError.CssClass = string.Empty;
            PanelError.Visible  = false;
        }

        ShippingMethods.DataSource     = shippingMethods;
        ShippingMethods.DataTextField  = "DisplayName";
        ShippingMethods.DataValueField = "Identifier";
        ShippingMethods.DataBind();
    }
Beispiel #2
0
    private void PopulateShippingMethods()
    {
        IEnumerable <IShippingMethod> shippingMethods = this.ShoppingCartModel.ShippingMethods;

        if (shippingMethods.Count() <= 0)
        {
            ShowError(StringResourceProvider.GetString("smartcheckout.aspx.131"));
            ShippingMethods.Items.Clear();
            this.Disable();
        }
        else
        {
            PanelError.Visible             = false;
            ShippingMethods.DataSource     = shippingMethods;
            ShippingMethods.DataTextField  = "DisplayName";
            ShippingMethods.DataValueField = "Identifier";
            ShippingMethods.DataBind();
        }
    }