Adding an additional Order Status to 4.50.3

3 months ago
In many previous versions of nopCommerce (prior to 4.50.3), it was simple enough to just make an addition to the OrderStatus enum and work some magic in the style sheets. That no longer works for me in version 4.50.3. Can someone please tell me how to add a new OrderStatus? Please don't bother with suggesting updating the OrderStatus enum, I've already tried that and in every case only 5 order statuses will show up in the debugger. Even making changes to the SQL Enum_OrderStatus table does not work either. And yes I have spent hours in the debugger looking through BaseAdminModelFactory, Extensions, OrderController and so on. I must be missing something although I do get a c# compiler error at one critical point that will not show what is under the caret. If someone has accomplished this, could you please share with me how you did it?

Thanks!
3 months ago
Yes, it should be "just make an addition to the OrderStatus enum".

RE: " only 5 order statuses will show up in the debugger."
Currently, there are only 4:
public enum OrderStatus
{
    Pending = 10,
    Processing = 20,
    Complete = 30,
    Cancelled = 40
}


RE: "making changes to the SQL Enum_OrderStatus table "
There is no such SQL table.

When you make a code change to add enum, be sure to Rebuild the Nop.Core project.
3 months ago
hemilis wrote:
Even making changes to the SQL Enum_OrderStatus table does not work
Dont know what you mean here as there is no OrderStatus table in SQL ?

To confirm how are you making the changes - changing the Core or via Plugin ?

Are you editing this file and adding extra Enum values
nopCommerce_4.50.3_Source\src\Libraries\Nop.Core\Domain\Orders\OrderStatus.cs

Yes you will need to make changes in a few areas for the values to display and use different colours for the new statuses

3 months ago
Hi Yidna, thanks for the speedy reply.
In the database for 4.5.3 there are three tables whose name starts with Enum_. The table I am referring to is Enum_OrderStatus. I wonder if you are not seeing those tables? And, yes, I am editing the OrderStatus.cs file. I even changed the names of some of the 4 statuses that show up in the Admin and those changes did not change in the Order status drop down. I've made numerous edits to the order status enum and none have been effective.
Thanks!
3 months ago
Running in the debugger, line 219 of OrderController return View(model); has 5 (yes 5) items:
All
Pending
Processing
Complete
Cancelled

Even though I have edited the OrderStatus enum and the Enum_OrderStatus
3 months ago
hemilis wrote:
In the database for 4.5.3 there are three tables whose name starts with Enum_. The table I am referring to is Enum_OrderStatus. I wonder if you are not seeing those tables?

These tables do not exisit in Standard nopCommerce
Do you have some third party plugin installed ?
Or maybe your nopCommerce version has been customised ?

You said you tried adding new records in the Table ?
3 months ago
Yidna & New York: much respect guys-- you two have helped a lot of us in nopCommerce land over the years. Thank you for that....
I will assume that those SQL tables were added by some other plugin-- I use a lot of plugins from nopTemplates and FoxNetSoft. So taking those tables out of the conversation, in previous versions of nopCommerce, using some version of Visual Studio, I edited the file Nop.Core.Domain.Orders.OrderStatus.cs, rebuilt everything and it worked. But in nopCommerce 4.5.3, editing the OrderStatus enum does not work. Does not work means in the admin, editing an order, the item list dropdown for Order Status is not changed. I'm trying to add Downloaded.
3 months ago
It looks like you are doing everything correctly

The reason I asked about the plugin is that if it is still installed then it maybe be overriding the default functionality - So even though you are changing the files above then the plugin may stop your changes from working ?


3 months ago
Yidna wrote:
It looks like you are doing everything correctly

The reason I asked about the plugin is that if it is still installed then it maybe be overriding the default functionality - So even though you are changing the files above then the plugin may stop your changes from working ?



I did some simple stuff to check on some things. First, I commented out everything in OrderStatus.cs and did a clean, build, rebuild and then start in debugging. The same five statuses showed up. I renamed OrderStatus.cs to OrderStatusx.cs and rebuilt the solution. Same 5 statuses showed up. I renamed the statuses in the nefarious Enum_OrderStatus table appending xxx to the text. Clean, build, rebuild start in debugger-- same 5 statuses. I appreciate your help and insight. Thank you!
3 months ago
I can change the text by editing LocaleStringResource ResourceName for example Enums.Nop.Core.Domain.Orders.OrderStatus.Cancelled
ResourceValue to Cancelledxxx
And after restarting the project AND Clearing Cache in the admin, the label text will change but the additional status was not included.
I also added
<LocaleResource Name="Enums.Nop.Core.Domain.Orders.OrderStatus.Downloaded">
    <Value>Downloaded</Value>
to defaultResources.nopres.xml.
Still does not show up.