Store UI, layout, design, look and feel; Discussion on the customer facing pages of your online store. Cascading Style Sheets, Themes, Scriptlets, NVelocity and the components in the ConLib directory.
-
evanb@firefold.com
- Lieutenant, Jr. Grade (LT JG)
![Lieutenant, Jr. Grade (LT JG) Lieutenant, Jr. Grade (LT JG)](./images/ranks/rank1.gif)
- Posts: 36
- Joined: Mon Jul 21, 2008 3:45 pm
Post
by evanb@firefold.com » Wed Oct 15, 2008 1:44 pm
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!
-
jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
-
Contact:
Post
by jmestep » Wed Oct 15, 2008 2:46 pm
It looks like you would have to put some coditional code on this in the vieworder.aspx.cs
CurrentPaymentStatus.Text = _Order.PaymentStatus.ToString();
-
William_firefold
- Commander (CMDR)
![Commander (CMDR) Commander (CMDR)](./images/ranks/rank4.gif)
- Posts: 186
- Joined: Fri Aug 01, 2008 8:38 am
Post
by William_firefold » Thu Oct 16, 2008 1:47 pm
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.
-
jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
-
Contact:
Post
by jmestep » Thu Oct 16, 2008 4:02 pm
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?
-
William_firefold
- Commander (CMDR)
![Commander (CMDR) Commander (CMDR)](./images/ranks/rank4.gif)
- Posts: 186
- Joined: Fri Aug 01, 2008 8:38 am
Post
by William_firefold » Fri Oct 17, 2008 8:43 am
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.
-
mazhar
- Master Yoda
![Master Yoda Master Yoda](./images/ranks/rank11.gif)
- Posts: 5084
- Joined: Wed Jul 09, 2008 8:21 am
-
Contact:
Post
by mazhar » Fri Oct 17, 2008 9:08 am
You can access the user groups as below on the ViewOrder page.
Code: Select all
string groups = "";
foreach (CommerceBuilder.Users.UserGroup userGroup in _Order.User.UserGroups)
{
groups += userGroup.Group.Name;
}
In the above example i just created a list of all groups the user belongs to.
Last edited by
mazhar on Mon Oct 20, 2008 10:40 am, edited 1 time in total.
-
AbleMods
- Master Yoda
![Master Yoda Master Yoda](./images/ranks/rank11.gif)
- Posts: 5170
- Joined: Wed Sep 26, 2007 5:47 am
- Location: Fort Myers, Florida USA
Post
by AbleMods » Fri Oct 17, 2008 9:46 am
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.
Test-UserGroups.zip
-
William_firefold
- Commander (CMDR)
![Commander (CMDR) Commander (CMDR)](./images/ranks/rank4.gif)
- Posts: 186
- Joined: Fri Aug 01, 2008 8:38 am
Post
by William_firefold » Fri Oct 17, 2008 11:44 am
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.
-
William_firefold
- Commander (CMDR)
![Commander (CMDR) Commander (CMDR)](./images/ranks/rank4.gif)
- Posts: 186
- Joined: Fri Aug 01, 2008 8:38 am
Post
by William_firefold » Fri Oct 17, 2008 12:13 pm
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
-
AbleMods
- Master Yoda
![Master Yoda Master Yoda](./images/ranks/rank11.gif)
- Posts: 5170
- Joined: Wed Sep 26, 2007 5:47 am
- Location: Fort Myers, Florida USA
Post
by AbleMods » Fri Oct 17, 2008 1:31 pm
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.
-
William_firefold
- Commander (CMDR)
![Commander (CMDR) Commander (CMDR)](./images/ranks/rank4.gif)
- Posts: 186
- Joined: Fri Aug 01, 2008 8:38 am
Post
by William_firefold » Fri Oct 17, 2008 1:36 pm
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";
}