Hi, I am facing an issue after adding a new column in nop_Customer table, the "Null" value gets inserted after registration of a user. How to resolve this? How can i get the method where i can insert the new field value through c# code?
Hey can you please tell me how you resolved it? Am trying to add new column to customer table - Am following below URL - https://www.nopcommerce.com/docs/73/updating-an-existing-entity-how-to-add-a-new-property.aspx
But, it's giving following error -
Invalid column name 'AreaCode'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Invalid column name 'AreaCode'.
Source Error:
Line 240: where c.Email == email Line 241: select c; Line 242: var customer = query.FirstOrDefault(); Line 243: return customer; Line 244: }
Source File: D:\Projects\Ekam\ekam\Libraries\Nop.Services\Customers\CustomerService.cs Line: 242 " " Am a newbie, so i don't know how to apply these to points as mentioned in that link
Recreate the database. Either your own custom SQL script or use the nopCommerce installer (blog coming soon). Stop the development web server between schema chagnes. It caches stuff and will cause a headache. Can anyone briefly explain the steps?
We can add new field to any entity in nopcommerce. step 1 Open Customer.cs class from Nop.Core\Domain add this line
publicstring YourProperty { get; set; }
Step 2 Open CustomerModel.cs class from Nop.Admin\Models add above line in this class.
Step 3 Open CustomerController.cs from Nop.Admin\Controller change in PrepareCustomerModel() and ActionResult Create(). add this property in this method.
Step 4 Open Customer table from your NopCommerce database. Note: Manually add this column in table. Add column in this table. Provide your newly added property name same as Customer.cs in Nop.Core\Domain
Change your _CreateOrUpdate.cshtml and add new property in this page. and run your project.
My question is more general. Suppose we successfully add custom fields to our db, models, etc. Then nopCommerece version X + 1 comes along. How do we incorporate all of the wonderful improvements of the new version without losing all of our modifications we've worked so hard to create in the previous version?
My question is more general. Suppose we successfully add custom fields to our db, models, etc. Then nopCommerece version X + 1 comes along. How do we incorporate all of the wonderful improvements of the new version without losing all of our modifications we've worked so hard to create in the previous version?
I think you don't need to worry about fields in your db. It will be remaining same when you will run update script.(most of the cases. But if you need any update in that update script you will able to do that.)
But You have to move your code manually. So you should keep track/region for these extra code.
What is the extra field you want to add ? What are you trying to achieve ? There is Custom Customer Attributes Configuration > Settings > Customer Settings See down the bottom of https://yourwebsite.com/Admin/Setting/CustomerUser
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.