Changing admin order payment type
-
- Lieutenant, Jr. Grade (LT JG)
- Posts: 36
- Joined: Mon Jul 21, 2008 3:45 pm
Changing admin order payment type
I believe this has been addressed before but let me discuss the concept which we would like to try and do:
In the picture above you see what I'm talking about.
What we need to do is separate purchase orders from the normal order types to display a different message than the others. Each purchase order that is placed must display "Net 30" beside "Payment:" instead of "paid" or "unpaid" etc.
If anyone can help with relevant information to allow us an entry point to start this modification we would be greatful!
In the picture above you see what I'm talking about.
What we need to do is separate purchase orders from the normal order types to display a different message than the others. Each purchase order that is placed must display "Net 30" beside "Payment:" instead of "paid" or "unpaid" etc.
If anyone can help with relevant information to allow us an entry point to start this modification we would be greatful!
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Re: Changing admin order payment type
It looks like you would have to put some coditional code on this in the vieworder.aspx.cs
CurrentPaymentStatus.Text = _Order.PaymentStatus.ToString();
CurrentPaymentStatus.Text = _Order.PaymentStatus.ToString();
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
- William_firefold
- Commander (CMDR)
- Posts: 186
- Joined: Fri Aug 01, 2008 8:38 am
Re: Changing admin order payment type
OK this seems pretty simple to me now but I need an IF statement that will do a comparison on the users group name.
If the person who placed the order is in user group "Net Terms"{
label="whatever"
}
I just need to know how to get the user and group from that page.
If the person who placed the order is in user group "Net Terms"{
label="whatever"
}
I just need to know how to get the user and group from that page.
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Re: Changing admin order payment type
Wouldn't you want to run it off the payment method for that one order? What if the customer changes groups? or is in two groups?
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
- William_firefold
- Commander (CMDR)
- Posts: 186
- Joined: Fri Aug 01, 2008 8:38 am
Re: Changing admin order payment type
No, the real purpose of this is simply to let our employees know that the person has terms with us.
We dont even need to change their payment type to anything.
What I need is just the syntax for getting the user's group while on that page so I can set the label based on their group.
If the user has multiple groups I can code for that but it would just need to see if they are in the Net Terms group.
We dont even need to change their payment type to anything.
What I need is just the syntax for getting the user's group while on that page so I can set the label based on their group.
If the user has multiple groups I can code for that but it would just need to see if they are in the Net Terms group.
Re: Changing admin order payment type
You can access the user groups as below on the ViewOrder page.
In the above example i just created a list of all groups the user belongs to.
Code: Select all
string groups = "";
foreach (CommerceBuilder.Users.UserGroup userGroup in _Order.User.UserGroups)
{
groups += userGroup.Group.Name;
}
Last edited by mazhar on Mon Oct 20, 2008 10:40 am, edited 1 time in total.
Re: Changing admin order payment type
Here's an example page (C-Sharp) of how to test for a specific group membership with the group name. Just unzip these files in the root of your store. Comments included in the code-behind file.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com
- William_firefold
- Commander (CMDR)
- Posts: 186
- Joined: Fri Aug 01, 2008 8:38 am
Re: Changing admin order payment type
Great code, this helps a lot.
foreach (CommerceBuilder.Users.UserGroup _UserGroup in _Order.User.UserGroups)
It works pretty well, but there is a little problem with it.
I decided to use the same code for the columns on
Admin/orders/default.aspx
It works except on certain pages of orders I get a popup
"Object reference not set to an instance of an object."
I have found this is due to the state of a particular order on whatever page gives the error.
It wouldnt even matter that it pops up but it makes it impossible to get to that page of orders.
It is on page 11 for us now but it changes as we get orders so I know the cause is an order.
foreach (CommerceBuilder.Users.UserGroup _UserGroup in _Order.User.UserGroups)
It works pretty well, but there is a little problem with it.
I decided to use the same code for the columns on
Admin/orders/default.aspx
It works except on certain pages of orders I get a popup
"Object reference not set to an instance of an object."
I have found this is due to the state of a particular order on whatever page gives the error.
It wouldnt even matter that it pops up but it makes it impossible to get to that page of orders.
It is on page 11 for us now but it changes as we get orders so I know the cause is an order.
- William_firefold
- Commander (CMDR)
- Posts: 186
- Joined: Fri Aug 01, 2008 8:38 am
Re: Changing admin order payment type
I removed my column code and visited the order on the page that threw the popup. The order page uses pretty much exactly what you uploaded. This is the error it threw:
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 112: bool _Found = false;
Line 113: // Loop through each group assigned to the user that placed this order
Line 114: foreach (CommerceBuilder.Users.UserGroup _UserGroup in _Order.User.UserGroups)
Line 115: {
Line 116: if (_UserGroup.Group.Name == _MyGroup)
Source File: d:\FireFold\Admin\Orders\ViewOrder.aspx.cs Line: 114
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 112: bool _Found = false;
Line 113: // Loop through each group assigned to the user that placed this order
Line 114: foreach (CommerceBuilder.Users.UserGroup _UserGroup in _Order.User.UserGroups)
Line 115: {
Line 116: if (_UserGroup.Group.Name == _MyGroup)
Source File: d:\FireFold\Admin\Orders\ViewOrder.aspx.cs Line: 114
Re: Changing admin order payment type
The code I posted was merely an example, it wasn't meant for production use inside another routine or page. There's all sorts of error checking that should occur so that everything exists as expected.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com
- William_firefold
- Commander (CMDR)
- Posts: 186
- Joined: Fri Aug 01, 2008 8:38 am
Re: Changing admin order payment type
I modified your code to catch the error. Thanks for all of your help.
Code: Select all
string _MyGroup = "Net Terms";
try{
foreach (CommerceBuilder.Users.UserGroup _UserGroup in order.User.UserGroups)
{
if (_UserGroup.Group.Name == _MyGroup && order.PaymentStatus.ToString()=="Unpaid")
{
return _MyGroup ;
}else if(_UserGroup.Group.Name == _MyGroup && order.PaymentStatus.ToString()=="Paid"){
return "Paid";
}
}
}catch{
return "PO No Acct";
}