Skip to content

Commit

Permalink
Further changes in estimate shipping form
Browse files Browse the repository at this point in the history
  • Loading branch information
mariannk committed Sep 6, 2017
1 parent 2624240 commit 3004671
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1498,17 +1498,21 @@ public virtual IActionResult GetEstimateShipping(int? countryId, int? stateProvi
if (string.IsNullOrEmpty(zipPostalCode))
{
errors.Append(_localizationService.GetResource("ShoppingCart.EstimateShipping.ZipPostalCode.Required"));
errors.Append("<br>");
}

if (countryId == null || countryId == 0)
{
if(errors.Length > 0)
errors.Append("<br>");

errors.Append(_localizationService.GetResource("ShoppingCart.EstimateShipping.Country.Required"));
}

if (errors.Length > 0)
{
return Content(errors.ToString());

}

var model = _shoppingCartModelFactory.PrepareEstimateShippingResultModel(cart, countryId, stateProvinceId, zipPostalCode);
return PartialView("_EstimateShippingResult", model);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,11 @@ public virtual EstimateShippingModel PrepareEstimateShippingModel(IList<Shopping
int? defaultEstimateCountryId = (setEstimateShippingDefaultAddress && _workContext.CurrentCustomer.ShippingAddress != null)
? _workContext.CurrentCustomer.ShippingAddress.CountryId
: model.CountryId;
model.AvailableCountries.Add(new SelectListItem
{
Text = _localizationService.GetResource("Address.SelectCountry"),
Value = "0"
});

foreach (var c in _countryService.GetAllCountriesForShipping(_workContext.WorkingLanguage.Id))
model.AvailableCountries.Add(new SelectListItem
Expand Down

0 comments on commit 3004671

Please sign in to comment.