How To: NopCommerce Best Practices for Address table
NopCommerce Versions: 3.7
Note: This is a draft version in progress.
Description: The Address table is used for capturing Address information for Registered Customers, Guest Checkout Customers and Orders.
- The best way to think about the Address table is that it has multi-state data meaning the Address data can be point in time created and associated with an Order and won't change again or current data that represents the current Address of a customer. Every time an order is created a snapshot point in time Address record is created (Duplicated) for the Billing Address and Shipping Address.
Table: Address
- Address1 (nvarchar, not null)
- Address2 (nvarchar, not null)
- City (nvarchar, not null)
- Company (nvarchar, not null)
- CompanyId (int, 4, not null)
- CountryId (int, 4, not null)
- CreatedOnUtc (datetime, 8)
- CustomAttributes (nvarchar, not null)
- Email (nvarchar, not null)
- FaxNumber (nvarchar, not null)
- FirstName (nvarchar, not null)
- Id (PK, int, 4)
- LastName (nvarchar, not null)
- PhoneNumber (nvarchar, not null)
- StateProvinceId (int, 4, not null)
- ZipPostalCode (nvarchar, not null)
Related Tables:
- AddressAttribute
- AddressAttributeValue
- CustomerAddresses
Uses:
- Retail Site > My Account > Addresses
- Customer Entity > Checkout
- Admin > Customer > Addresses
Extending:
- The Address table already contains an extensive common set of information relating to addresses. Instead of modifying the table, you should add a table that has a foreign key to the Address table but is also the primary key.