OrderTemplates
Windows Server Forum Index Windows Server
Server discussion on Windows platform.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web winserverhelp.com
OrderTemplates

 
Post new topic   Reply to topic    Windows Server Forum Index -> Commerce Server
Author Message
MJ
Guest





Posted: Wed Oct 26, 2005 12:50 am    Post subject: OrderTemplates Reply with quote

Hi All,

How do I retrieve the ordertemplate for the current user? I saved the
orderTemplate using the orderTemplate.Save(ordTempName) to the basketgroup.
To retrieve the ordertemplate for the current user I'm trying to use the
OrderSystem.GetOrderTemplate(CommerceContext.Current.UserID, ???); but don't
know where the 2nd parameter comes from i.e. the orderTemplateID. I hope I’m
on the right trace to retrieve the orderTemplate ?
Also if there are multiple ordertemplates for the user how do I get all
those templates at once? Can someone help me on this!!!


Thanks
Back to top
Jeff Lynch
Guest





Posted: Wed Oct 26, 2005 12:50 am    Post subject: Re: OrderTemplates Reply with quote

Try this to return a DataSet of the user's templates.


public DataSet FindTemplatesForUser(string UserID)
{
OrderGroupSearch OGS = new
OrderGroupSearch(CommerceContext.Current.OrderSystem);
OrderGroupSearchOptions OGSOS = new OrderGroupSearchOptions();

OGS.OrderStatusFilter = 2; //order template
OGS.UserID = new Guid(UserID);

OGSOS.Columns.Add("ordergroup_id");
OGSOS.Columns.Add("saved_order_name");
OGSOS.SortColumnName = "saved_order_name";

return OGS.Search(OGSOS);
}

And this to convert the template to a basket

public void SaveTemplateAsBasket(string UserID, string TemplateID)
{
OrderTemplate template =
CommerceContext.Current.OrderSystem.GetOrderTemplate(new Guid(UserID), new
Guid(TemplateID));
_Basket.Clear();
_Basket.Add(template);
UpdateBasket();
}

--
Jeff Lynch
"A BizTalk Enthusiast"
http://codebetter.com/blogs/jeff.lynch
Back to top
Ravi Shankar
Guest





Posted: Wed Oct 26, 2005 8:51 am    Post subject: RE: OrderTemplates Reply with quote

In the Save as template call the return value is the GUID of the template
stored (similar to order_id if you execute the saveasorder). This GUID is the
second parameter. Typically you'd use one of the free fields in the
userobject profile to store it after creation :) for subsequent retreival.
--
Ravi Shankar
Back to top
MJ
Guest





Posted: Thu Oct 27, 2005 8:51 pm    Post subject: RE: OrderTemplates Reply with quote

Thanks Jeff and Ravi I'll try both the solutions and decided with one to use.
Thanks
Back to top
 
Post new topic   Reply to topic    Windows Server Forum Index -> Commerce Server All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




New Topics Powered by phpBB