Proposal of a modified nopCommerce architecture to extend entities

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
9 anni tempo fa
aaarggh!

I see it in your code: I used the wrong namespace. Iwas referring to a Domain class and put it in the Mapping namespace

had to be  Nop.Core.Domain.Catalog

my bad!

thx!
9 anni tempo fa
All good...its part of the fun of developing :-)
8 anni tempo fa
How I can extend Core Entity with the Help  use of Plugin.

My Requirement is that : add a new field "InvoiceNumber" in Order table through Plugin,  and when Customer will place an order, I can set the InvoiceNumber value through Plugin.

Getting Problem : unable to extend the Order through Plugin.
8 anni tempo fa
You cannot extend a core entity from a plugin. Read this thread for more information.
What you can do is storing your extra order information on another table, with the orderId.
8 anni tempo fa
Apart from creating a new table to store an invoice Id, one can also use the simple GenericAttribute class.
8 anni tempo fa
Hi,
Is this architecture implemented in nop 3.70? Can I use this architecture in nop 3.70?
8 anni tempo fa
nadeemn wrote:
Hi,
Is this architecture implemented in nop 3.70? Can I use this architecture in nop 3.70?

Yes
7 anni tempo fa
Hi all
I tried to extend OrderItem entity in this way. So I created partial class with definition

namespace Nop.Core.Domain.Orders
{
    public partial class OrderItem
    {
        public OrderItemStatus OrderItemStatus
        {
            get { return (OrderItemStatus)this.OrderItemStatusId; }
            set { this.OrderItemStatusId = (int)value; }
        }

        public int OrderItemStatusId { get; set; }
    }
}

public partial class OrderItemMap
{
    protected override void PostInitialize()
    {
        this.Ignore(o => o.OrderItemStatus);
    }
}


I added a field OrderItemStatusId to the OrderItem table in the database. But on run I've got an exception the model and database are different.

I tried to remove database and have it created by Nop installation. During the installation I've got an exception "The specified table does not exist. [ Store ]".

I've checked created database and found out there are no tables at all. So that makes me think during database creation no tables were added at all due to some my code induced error, which was silently ignored.

What can I do about that?
6 anni tempo fa
Is there anyway to override a property that has .HasPrecision(18, 4)? I tried the method in this post and it doesn't seem to work.

We are trying to increase the number of decimal spots on Tier pricing from 4 to 6 decimals. I have created a Plugin that does this and all works except when using the admin console to add/update a TierPrice. When saved it only saves 4 decimals.

I created a custom folder in Nop.Data and created the below class to try to override the precision

using Nop.Core.Domain.Catalog;

namespace Nop.Data.Mapping.Catalog {
   public partial class TierPriceMap  {
      protected override void PostInitialize() {
         Property(tp => tp.Price).IsOptional().HasPrecision(18, 6);
      }
   }
}


My plugin changes the Precision in the Database and updates the precision in the EditorTemplates. If i remove the .HasPrecision(18, 4)  from this.Property(tp => tp.Price) in  \Nop.Data\Mapping\Catalog\TierPriceMap.cs. Everything seems to work. We would like to figure out a way to override properties that have HasPrecision set outside of modify the NopCore code.
4 anni tempo fa
So.

In version 4.2 NetCore is it possible. to add a property to a entity core through a plugin?

I tried and did not succeed.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.