Issue with Discount on Current Cart - Customer spending over x.xx amount

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
4 年 前
Installed a plugin to use a discount code for cart if a customer is spending over a certain amount of money. Found this plugin that should fit my needs, but getting an error when trying use the set coupon code. Here is a link to the plugin I've downloaded and installed. http://www.nopcommerceplus.com/discount-on-current-shopping-cart-subtotal

I'm running Nop 4.20


Log level: Error
Short message:  
Could not load type 'Nop.Services.Orders.ShoppingCartExtensions' from assembly 'Nop.Services, Version=4.2.0.0, Culture=neutral, PublicKeyToken=null'.
Full message:  
System.TypeLoadException: Could not load type 'Nop.Services.Orders.ShoppingCartExtensions' from assembly 'Nop.Services, Version=4.2.0.0, Culture=neutral, PublicKeyToken=null'.
   at Nop.Plugin.DiscountRules.SpendAmountOver.SpendAmountOverDiscountRequirementRule.CheckRequirement(DiscountRequirementValidationRequest request)
   at Nop.Services.Discounts.DiscountService.GetValidationResult(IEnumerable`1 requirements, RequirementGroupInteractionType groupInteractionType, Customer customer, List`1 errors) in C:\andrei\nopcommerce\sources\src\Libraries\Nop.Services\Discounts\DiscountService.cs:line 152
   at Nop.Services.Discounts.DiscountService.GetValidationResult(IEnumerable`1 requirements, RequirementGroupInteractionType groupInteractionType, Customer customer, List`1 errors) in C:\andrei\nopcommerce\sources\src\Libraries\Nop.Services\Discounts\DiscountService.cs:line 141
   at Nop.Services.Discounts.DiscountService.ValidateDiscount(DiscountForCaching discount, Customer customer, String[] couponCodesToValidate)
   at Nop.Web.Controllers.ShoppingCartController.<>c__DisplayClass51_1.<ApplyDiscountCoupon>b__1(DiscountForCaching discount) in C:\andrei\nopcommerce\sources\src\Presentation\Nop.Web\Controllers\ShoppingCartController.cs:line 1439
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
   at Nop.Web.Controllers.ShoppingCartController.ApplyDiscountCoupon(String discountcouponcode, IFormCollection form) in C:\andrei\nopcommerce\sources\src\Presentation\Nop.Web\Controllers\ShoppingCartController.cs:line 1445
   at lambda_method(Closure , Object , Object[] )
   at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()
   at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
   at WebMarkupMin.AspNetCore2.WebMarkupMinMiddleware.Invoke(HttpContext context)
   at StackExchange.Profiling.MiniProfilerMiddleware.Invoke(HttpContext context) in C:\projects\dotnet\src\MiniProfiler.AspNetCore\MiniProfilerMiddleware.cs:line 94
   at Nop.Services.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) in C:\andrei\nopcommerce\sources\src\Libraries\Nop.Services\Authentication\AuthenticationMiddleware.cs:line 79
   at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Nop.Services.Installation.InstallUrlMiddleware.Invoke(HttpContext context, IWebHelper webHelper) in C:\andrei\nopcommerce\sources\src\Libraries\Nop.Services\Installation\InstallUrlMiddleware.cs:line 52
   at Nop.Services.Common.KeepAliveMiddleware.Invoke(HttpContext context, IWebHelper webHelper) in C:\andrei\nopcommerce\sources\src\Libraries\Nop.Services\Common\KeepAliveMiddleware.cs:line 49
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.Invoke(HttpContext context)
4 年 前
You are best to contact the plugin supplier directly
http://www.nopcommerceplus.com/
4 年 前
No luck with contacting the developer. Are there any other options that others use?
4 年 前
If your requirement is to display discount box after a minimum amount is in the cart, then you can achieve this by a small customization. Go to ShoppingCartModelFactory.PrepareShoppingCartModel(). Get cart total using this code before line no 842.

_orderTotalCalculationService.GetShoppingCartSubTotal(cart, true, out decimal _, out List<DiscountForCaching> _, out decimal subTotalWithoutDiscount, out decimal subTotalWithDiscount)


Then modify line 842 like below.

model.DiscountBox.Display = _shoppingCartSettings.ShowDiscountBox && subTotalWithDiscount >= {yourExpectedMinimumCartAmount};
4 年 前
Try another?

https://www.nopcommerce.com/discount-rule-minimum-xxx-cart-subtotal-amount-nopadvance-team
4 年 前
I had the same problem yesterday and i solve it by adding a class named ShoppingCartExtensions into the namespace Nop.Services.Orders as the code below:


namespace Nop.Services.Orders
{
    /// <summary>
    /// Represents a shopping cart
    /// </summary>
    public static class ShoppingCartExtensions
    {
        /// <summary>
        /// Limit cart by store (if carts are not shared between stores)
        /// </summary>
        /// <param name="cart">Cart</param>
        /// <param name="storeId">Store identifier</param>
        /// <returns>Cart</returns>
        public static IEnumerable<ShoppingCartItem> LimitPerStore(this IEnumerable<ShoppingCartItem> cart, int storeId)
        {
            var shoppingCartSettings = EngineContext.Current.Resolve<ShoppingCartSettings>();
            if (shoppingCartSettings.CartsSharedBetweenStores)
                return cart;

            return cart.Where(x => x.StoreId == storeId);
        }
    }
}



The problem is that this code was removed in the version 4.2 and this plugin still use it.
4 年 前
marouen - Glad you found a solution to the issue. I struggled with it for some time, but thanks to New York I found a different plugin to use. It was free and did just as I needed without issue.

https://www.nopcommerce.com/discount-rule-minimum-xxx-cart-subtotal-amount-nopadvance-team
4 年 前
groundzero2010 wrote:
Installed a plugin to use a discount code for cart if a customer is spending over a certain amount of money. Found this plugin that should fit my needs, but getting an error when trying use the set coupon code. Here is a link to the plugin I've downloaded and installed. http://www.nopcommerceplus.com/discount-on-current-shopping-cart-subtotal

I'm running Nop 4.20


Hello,

Sorry for the inconvenience. Again sorry that i didn't checked forum yesterday that you are facing issue with our plugin. Even i didn't received any mail from your side otherwise i could help you with it.

Let me know if are you still looking for solution.

Thanks,
Jatin
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.