How to - extending nopCommerce (1.X versions)

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 years ago
nopCommerce team | retroviz wrote:
I explain at the start of the article that I am extending the partial class:

Indeed you did.  I think I read it so many times I became blind to it.  My mistake.
13 years ago
Ben is my hero.  I knew there was a secret handshake.  :)
13 years ago
One more question.  Is the following a known item?  I don't have any compile errors but at run-time I get alot of the following at

  if ((_settings == null))
                {
                    _settings = CreateObjectSet<Setting>();
                }

The relationship 'NopSolutions.NopCommerce.BusinessLogic.Data.FK_Nop_TierPrice_Nop_ProductVariant' was not loaded because the type 'NopSolutions.NopCommerce.BusinessLogic.Data.ProductVariant' is not available.
The following information may be useful in resolving the previous error:
The required property 'RequiresTextOption' does not exist on the type 'NopSolutions.NopCommerce.BusinessLogic.Products.ProductVariant'.
13 years ago
Looking at the error, are you sure you have disabled code generation on the edmx?
13 years ago
Yes.  All the ambiguity issues are gone.  The Designer file is empty.
13 years ago
The designer should not be empty. The only thing you need to ensure is to right click the edmx in solution explorer > properties > and make sure custom tool is blank.
13 years ago
I removed the custom tool reference.  I think I found the NopProblem (some of the items were mine).

The following fields are out of sync between the business object and database


Product Table:   ProductTypeId  

ProductVariant
RequiresTextOption
TextOption
AllowOutOfStockOrders


Should I remove them from the database?  I added them to the business classes but I then would have to fix all the inserts etc.
13 years ago
nopCommerce team | retroviz wrote:

Super,

If you follow the concepts of the article you should not have any problems extending one of the existing entities. I had a quick look at your post and you mentioned 1.4. Just to clarify this applies to 1.7 onwards (using entity framework). As aGorilla commented on your post, if you are extending an existing class (i.e. adding new fields to the table) then you need to make sure your class name is the same, is partial and is in the same namespace. Also you should update the existing insert/update methods to take in the extra parameters (again covered in my article).

If you are adding a new entity  you can take a more domain driven approach and just pass in the object itself (we will be using this approach in 1.9).


Ben


Ben, thank you for your time, i will be very great full if you could help me with the code as i am new in asp.net technology.

https://www.nopcommerce.com/boards/t/6968/i-need-help-in-adding-extra-product-fields-in-database.aspx
13 years ago
help??
13 years ago
Hi,

The article covers the core concepts of extending the nopCommerce model. If you are having difficulty understanding these concepts and are new to asp.net in general, I would recommend getting an overall understanding of the asp.net platform before jumping into an app like nopCommerce.

There are some great tutorials on the asp.net website
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.