Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/grandnode/grandnode into…
Browse files Browse the repository at this point in the history
… develop
  • Loading branch information
dan269 committed Jul 8, 2019
2 parents 05fa609 + 41b8fde commit 16ddde2
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
4 changes: 4 additions & 0 deletions Grand.Services/Orders/ShoppingCartService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1447,6 +1447,10 @@ await AddToCart(toCustomer, sci.ProductId, sci.ShoppingCartType, sci.StoreId,
//copy url referer
var lastUrlReferrer = await fromCustomer.GetAttribute<string>(_genericAttributeService, SystemCustomerAttributeNames.LastUrlReferrer);
await _genericAttributeService.SaveAttribute(toCustomer, SystemCustomerAttributeNames.LastUrlReferrer, lastUrlReferrer);

//move selected checkout attributes
var checkoutAttributesXml = await fromCustomer.GetAttribute<string>(_genericAttributeService, SystemCustomerAttributeNames.CheckoutAttributes, _storeContext.CurrentStore.Id);
await _genericAttributeService.SaveAttribute(toCustomer, SystemCustomerAttributeNames.CheckoutAttributes, checkoutAttributesXml, _storeContext.CurrentStore.Id);
}

#endregion
Expand Down
6 changes: 6 additions & 0 deletions Grand.Web/Areas/Admin/Controllers/ProductController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,12 @@ public async Task<IActionResult> CopyProduct(ProductModel model, [FromServices]
if (_workContext.CurrentVendor != null && originalProduct.VendorId != _workContext.CurrentVendor.Id)
return RedirectToAction("List");

if (_workContext.CurrentCustomer.IsStaff())
{
originalProduct.LimitedToStores = true;
originalProduct.Stores.Add(_workContext.CurrentCustomer.StaffStoreId);
}

var newProduct = await copyProductService.CopyProduct(originalProduct,
copyModel.Name, copyModel.Published, copyModel.CopyImages);
SuccessNotification("The product has been copied successfully");
Expand Down
15 changes: 9 additions & 6 deletions Grand.Web/Controllers/ShoppingCartController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public partial class ShoppingCartController : BasePublicController
private readonly IShoppingCartViewModelService _shoppingCartViewModelService;
private readonly IGenericAttributeService _genericAttributeService;
private readonly ShoppingCartSettings _shoppingCartSettings;
private readonly OrderSettings _orderSettings;

#endregion

Expand All @@ -62,7 +63,8 @@ public ShoppingCartController(
IDownloadService downloadService,
IShoppingCartViewModelService shoppingCartViewModelService,
IGenericAttributeService genericAttributeService,
ShoppingCartSettings shoppingCartSettings)
ShoppingCartSettings shoppingCartSettings,
OrderSettings orderSettings)
{
this._workContext = workContext;
this._storeContext = storeContext;
Expand All @@ -77,6 +79,7 @@ public ShoppingCartController(
this._shoppingCartViewModelService = shoppingCartViewModelService;
this._genericAttributeService = genericAttributeService;
this._shoppingCartSettings = shoppingCartSettings;
this._orderSettings = orderSettings;
}

#endregion
Expand Down Expand Up @@ -322,7 +325,7 @@ public virtual async Task<IActionResult> DeleteCartItem(string id, bool shopping
public virtual IActionResult ContinueShopping()
{
var returnUrl = _workContext.CurrentCustomer.GetAttributeFromEntity<string>(SystemCustomerAttributeNames.LastContinueShoppingPage, _storeContext.CurrentStore.Id);
if (!String.IsNullOrEmpty(returnUrl))
if (!string.IsNullOrEmpty(returnUrl))
{
return Redirect(returnUrl);
}
Expand All @@ -332,13 +335,13 @@ public virtual IActionResult ContinueShopping()
}
}

[HttpPost]
public virtual async Task<IActionResult> StartCheckout(IFormCollection form, [FromServices] OrderSettings orderSettings)
public virtual async Task<IActionResult> StartCheckout(IFormCollection form = null)
{
var cart = _shoppingCartService.GetShoppingCart(_storeContext.CurrentStore.Id, ShoppingCartType.ShoppingCart, ShoppingCartType.Auctions);

//parse and save checkout attributes
await _shoppingCartViewModelService.ParseAndSaveCheckoutAttributes(cart, form);
if (form != null && form.Count > 0)
await _shoppingCartViewModelService.ParseAndSaveCheckoutAttributes(cart, form);

//validate attributes
var checkoutAttributes = await _workContext.CurrentCustomer.GetAttribute<string>(_genericAttributeService, SystemCustomerAttributeNames.CheckoutAttributes, _storeContext.CurrentStore.Id);
Expand All @@ -351,7 +354,7 @@ public virtual async Task<IActionResult> StartCheckout(IFormCollection form, [Fr
//everything is OK
if (_workContext.CurrentCustomer.IsGuest())
{
if (!orderSettings.AnonymousCheckoutAllowed)
if (!_orderSettings.AnonymousCheckoutAllowed)
return Challenge();

return RedirectToRoute("LoginCheckoutAsGuest", new { returnUrl = Url.RouteUrl("ShoppingCart") });
Expand Down
2 changes: 1 addition & 1 deletion Grand.Web/Services/ShoppingCartViewModelService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ public virtual async Task PrepareWishlist(WishlistModel model,
var subtotal = await _priceCalculationService.GetSubTotal(sci, true);
decimal shoppingCartItemDiscountBase = subtotal.discountAmount;
List<AppliedDiscount> scDiscounts = subtotal.appliedDiscounts;
var productprices = await _taxService.GetProductPrice(product, subtotal.discountAmount);
var productprices = await _taxService.GetProductPrice(product, subtotal.subTotal);
decimal taxRate = productprices.taxRate;
decimal shoppingCartItemSubTotalWithDiscountBase = productprices.productprice;

Expand Down

0 comments on commit 16ddde2

Please sign in to comment.