Tag: nopcommerce

如何使用插件中的视图文件覆盖nopcommerce视图文件?

我试图覆盖位于以下位置的nopcommerce视图: Nop.Admin/Views/Category/Tree.cshtml 我在插件文件夹中开发了一个视图: Views/Misc/Tree.cshtml 我该怎么做?

如何在NopCommerce中实现动作filter

我想从CheckoutController更改OpcSaveBilling操作的一些代码中的一些代码。 我不想改变NopCommerce的核心代码,所以我需要尝试使用我自己的自定义代码覆盖代码。 我读过这篇文章是为了让我开始http://www.pronopcommerce.com/overriding-intercepting-nopcommerce-controllers-and-actions 。 根据我的阅读,您可以在执行操作之前和执行操作之后执行自己的代码。 但我没有得到的是文章留下的部分(需要执行的实际代码)。 我基本上想要的是原始代码的相同function,但有一些自定义调整。 我在OnePageCheckout视图中添加了一个复选框,根据该复选框,它需要在结帐时跳过输入送货地址部分。 (使用送货地址的帐单邮寄地址) 我已经在核心代码和这项工作中添加了代码并跳过了这一步(注意:我知道我仍然需要手动添加帐单地址作为送货地址)但是就像我说我不想改变代码NopCommerce的核心,但覆盖它。 如果我的问题不可理解,您需要更多代码或解释,我很乐意提供更多。 如果我这样做的方式不适合我想要的,如果你告诉我,我将不胜感激! 我的代码: Action Filter类: using Nop.Web.Controllers; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Web.Mvc; namespace Nop.Plugin.Misc.MyProject.ActionFilters { class ShippingAddressOverideActionFilter : ActionFilterAttribute, IFilterProvider { public IEnumerable GetFilters(ControllerContext controllerContext, ActionDescriptor actionDescriptor) { if (controllerContext.Controller is CheckoutController && actionDescriptor.ActionName.Equals(“OpcSaveBilling”, StringComparison.InvariantCultureIgnoreCase)) { return new […]

在asp.net中序列化会话状态

我正在尝试在我们的nopcommerce 1.9安装中将会话状态存储在SQL而不是InProc中。 当我对web.config进行必要的更改时,我收到此错误: ‘/’应用程序中的服务器错误。 无法序列化会话状态。 在“StateServer”和“SQLServer”模式下,ASP.NET将序列化会话状态对象,因此不允许使用不可序列化的对象或MarshalByRef对象。 如果自定义会话状态存储在“自定义”模式下执行类似的序列化,则适用相同的限制。 描述:执行当前Web请求期间发生未处理的exception。 请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。 exception详细信息:System.Web.HttpException:无法序列化会话状态。 在“StateServer”和“SQLServer”模式下,ASP.NET将序列化会话状态对象,因此不允许使用不可序列化的对象或MarshalByRef对象。 如果自定义会话状态存储在“自定义”模式下执行类似的序列化,则适用相同的限制。 来源错误: 在执行当前Web请求期间生成了未处理的exception。 可以使用下面的exception堆栈跟踪来识别有关exception的起源和位置的信息。 堆栈跟踪: [SerializationException:在程序集’Nop.BusinessLogic中输入’NopSolutions.NopCommerce.BusinessLogic.Categories.Category’,Version = 1.9.0.0,Culture = neutral,PublicKeyToken = null’未标记为可序列化。 System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type)+9449041 System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type,StreamingContext context)+247 System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo()+160 System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Type objectType,ISurrogateSelector surrogateSelector,StreamingContext context,SerObjectInfoInit serObjectInfoInit,IFormatterConverter converter,SerializationBinder binder)+ 371 System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteArray(WriteObjectInfo objectInfo,NameInfo memberNameInfo,WriteObjectInfo memberObjectInfo)+205 System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Write(WriteObjectInfo objectInfo,NameInfo memberNameInfo,NameInfo typeNameInfo)+651 System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph,Header [] inHeaders,__BinaryWriter serWriter,Boolean fCheck)+444 System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream,Object graph, Header […]

在asp.net Web api和angular js中使用的身份validation方法

我正在使用Web api和angular js创建一个网站,我对在我的网站上使用的身份validation感到非常困惑。 我创建了一个login.js ,其中有我的Login方法,它将我的用户名/ Emailid和密码发布到我的Web Api,web api中的方法将validation该用户。 码: $scope.Login() { $.post(“api/Authentication/Login”,Username,Password) { } } Web api代码: [Route] Public Task Login([FromBody] username,password) { //method to authenticate user from database. //Now the tricky parts comes like after authenticating user should i //just store the user id in my session like this Session[“userid]=id or //Should i go […]

Razor HTML Helpers在Nop Commerce插件中提供智能感知错误

我正在为Nop Commerce编写一个插件,我的HTML助手正在给我智能感知错误。 我得到红线强调它们和错误: 不能使用function’扩展方法’,因为它不是ISO-2 C#语言规范的一部分 无法使用function’lambda表达式’,因为它不是ISO-2 C#语言规范的一部分 这是我的代码: @{ Layout = “”; } @model Nop.Plugin.Widgets.HelloWorld.Models.ConfigurationModel @using Nop.Web.Framework; @Html.Action(“StoreScopeConfiguration”, “Setting”, new { area = “Admin” }) @using (Html.BeginForm()) { Hello World Configuration @Html.OverrideStoreCheckboxFor(model => model.Greeting_OverrideForStore, model => model.Greeting, Model.ActiveStoreScopeConfiguration) @Html.NopLabelFor(model => model.Greeting): @Html.EditorFor(model => model.Greeting) @Html.ValidationMessageFor(model => model.Greeting) @Html.OverrideStoreCheckboxFor(model => model.Name_OverrideForStore, model => model.Name, Model.ActiveStoreScopeConfiguration) @Html.NopLabelFor(model […]

单个解决方案中的多个MVC项目

我在NopCommerce项目中看到有一个解决方案,解决方案中有多个MVC项目。 我有一些问题,例如: 如何共享主要布局或按需使用不同的布局? 如何在不同的MVC项目中使用控制器/模型等? 我还想要一个主要项目和多个子MVC项目。 如何在共享组件时完成此操作? 有任何想法吗? 指针? 注意:对区域不感兴趣。

使用未分配的变量?

在声明paymentstatus是否为null或“if”语句中是否有值时,我得到了未分配变量“ps”的错误使用。 我在想我已经宣布了ps,但显然我做错了。 为什么编译器抱怨这个? 这是上下文中的错误: public IList DailyBestsellersReport() { OrderStatus os; PaymentStatus? ps; ShippingStatus ss; int billingCountryId = 0; int recordsToReturn = 999; int orderBy = 1; int groupBy = 1; int? paymentStatusId = null; if (ps.HasValue) paymentStatusId = (int)ps.Value; // Specifies the time range for sold products/day var range = new { startTimeUtc = DateTime.Today.AddDays(-1), […]

非常接近,但不能完全覆盖核心视图nopcommerce

我一直在读Wooncherk , Twisted Whisperer和Alex Wolf的一些非常好的post。 他们的文章分别(Wooncherk) , (Twisted Whisperer)和(Alex Wolf)提供了非常丰富的信息,但是我不像其他SO社区那样聪明,也不能把我所缺少的东西拼凑起来。 我正在覆盖管理区域中的核心视图…特别是订单编辑视图。 我看到的行为是它没有点击我的插件中的控制器,但它显示我的自定义视图。 问题是自定义视图在Admin项目中,这真让我感到困惑。 如何拥有自包含的插件,但必须将我的自定义视图安装到核心管理区域? 我想,也许是错误的,会发生的事情是,由于我更高的定义优先级,我的控制器会在搜索路径时首先被击中。 所以遵循这里的指示是我的代码。 CustomViewEngine: private readonly string[] _emptyLocations = null; public CustomViewEngine() { PartialViewLocationFormats = new[] { “~/Administration/MyExtension/Views/{1}/{0}.cshtml”, “~/Administration/MyExtension/Views/Shared/{0}.cshtml” }; ViewLocationFormats = new[] { “~/Administration/MyExtension/Views/{1}/{0}.cshtml”, “~/Administration/MyExtension/Views/Shared/{0}.cshtml” }; } protected override string GetPath(ControllerContext controllerContext, string[] locations, string[] areaLocations, string locationsPropertyName, string name, string […]

覆盖部分类中的虚方法

我目前正在使用nopCommerce源代码并尽力避免编辑源代码,而是使用与源代码分开的部分类和插件,我们是否需要升级版本。 我想通过在同一个程序集中使用部分类来对下订单的代码进行一些更改: Orignal源代码: namespace Nop.Services.Orders { public partial class OrderProcessingService : IOrderProcessingService { public virtual PlaceOrderResult PlaceOrder(ProcessPaymentRequest processPaymentRequest) { //…. 我的部分课程: namespace Nop.Services.Orders { public partial class OrderProcessingService : IOrderProcessingService { public override PlaceOrderResult PlaceOrder(ProcessPaymentRequest processPaymentRequest) { //…. 当我尝试编译此代码时,我收到一个错误: 类型’Nop.Services.Orders.OrderProcessingService’已经使用相同的参数类型定义了一个名为’PlaceOrder’的成员 但我使用override ,原始类中的方法是virtual ,有人可以告诉我这里我出错了,以及如何覆盖此方法?

带有语句体的lambda表达式无法转换为nopCommerce 中的表达式树

我尝试在nopCommerce 3.0中创建一个linq连接查询。 我加入linq的两张桌子并写 代码成功了。 但视觉工作室的知识分子显示出错误 具有语句主体的lambda表达式无法转换为表达式树 请看下面的代码 var roles = _customerEventRoleRepository.Table.Where(c => c.EventId == selevent) .Join ( _customerRepository.Table, cev => cev.CustomerId, c => c.Id, (cev, c) => { var cust = new CustomerEventRolesModel(); cust.Id = cev.Id; cust.CustomerId = c.Id; cust.Customer = c.Email; cust.ContactName = c.GetAttribute(SystemCustomerAttributeNames.FirstName); cust.CompanyName = c.GetAttribute(SystemCustomerAttributeNames.Company); cust.Speaker = cev.IsSpeaker; cust.Sponsor = cev.IsSponser; return […]