|
Home > Archive > Commerce Server General > June 2005 > URGENT: cannot delete lineitem from order. please help me..
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
URGENT: cannot delete lineitem from order. please help me..
|
|
| Volf Green 2005-06-15, 6:00 pm |
| Hi,
I need to modify order already stored in CS2002.
I successfully modified bizdesk module, and added delete button after
selecting a lineitem when viewing orderdetail.
I have the specific ordergroup_id and lineitem_id.
Can someone give me a piece of "asp" code to accomplish this?
First I tried to use RemoveItem(), which removed the item, but when
viewing the order from website, I got an index error, seemed like it
still had the item stored somewhere...
Secondly, I tried to set quantity of the lineitem to 0, that worked,
but totals stayed same. I can't seem to find an example of how to run
the pipeline/update the totals of the order.
If someone can help me, I'd rather remove the lineitem from order
completely.
My code below is located in bizdesk asp page: "orderstatus_view.asp"
Any help would be greatly appriciated(I've spend the whole day on
this)
Thanks,
Mike
*********CODE**********
Dim oOrderGroup, sOrderGroupId, sNewOrderStatus, sLastName,
sOrderFormName, m_UserId, dictContext
sOrderGroupId = "{ADCDA4CE-7FE9-4618-BEA9-7979A6DFF5A7}"
m_UserId = "{63F5E1FF-C2F9-48A9-B356-25F0C8C3FD9F}"
sNewOrderStatus = 32
sLastName = "Dork"
Set oOrderGroup = GetOrderGroup(sOrderGroupId)
Call oOrderGroup.LoadOrder(sOrderGroupID)
Response.write "after Call oOrderGroup.LoadOrder(sOrderGroupID)"
For Each sOrderFormName In oOrderGroup.Value.OrderForms
'Call mscsOrderGrp.PutOrderFormValue(sKey, sValue, sOrderFormName)
Call oOrderGroup.PutOrderFormValue("order_status_code",
sNewOrderStatus,sOrderFormName)
Call oOrderGroup.PutOrderFormValue("user_last_name",
sLastName,sOrderFormName)
Call oOrderGroup.PutItemValue("quantity", 0, True,2,sOrderFormName)
Next
Call oOrderGroup.SaveAsOrder()
Set dictContext = Server.CreateObject("Commerce.Dictionary")
Set dictContext.CacheManager =
Server.CreateObject("Commerce.CacheManager")
dictContext.ShippingManagerCache = "Commerce.ShippingManagerCache"
Call oOrderGroup.RunPipe(" C:\Inetpub\wwwroot\retail2002\Pipelines\
total.pcf",
"Commerce.PooledPipeline", dictContext)
Function GetOrderGroup(ByVal sOrderGroupID)
Dim mscsOrderGrp, dictConfig
Set dictConfig = GetConfigDictionary()
Set mscsOrderGrp = Server.CreateObject("Commerce.OrderGroup")
Call mscsOrderGrp.Initialize(dictConfig. s_TransactionsConnectionString,sOrderGro
upID)
'Call mscsOrderGrp.Initialize(dictConfig. s_TransactionsConnectionString,m_UserID)
Set GetOrderGroup = mscsOrderGrp
End Function
Function GetConfigDictionary()
Dim mscsAppConfig
Set mscsAppConfig = GetAppConfigObject()
Set GetConfigDictionary = mscsAppConfig.GetOptionsDictionary("")
End Function
Function GetAppConfigObject()
Dim mscsAppConfig, mscsSiteCfg
' Is the AppConfig object stored in the Application object?
If Not IsObject(Application("MSCSAppConfig")) Then
' Create and initialize the AppConfig object.
Set mscsAppConfig = Server.CreateObject("Commerce.AppConfig")
Call mscsAppConfig.Initialize(MSCSCommerceSiteName)
' Inject some special values into the configuration dictionary...
Set dictConfig = mscsAppConfig.GetOptionsDictionary("")
Set mscsSiteCfg = GetSiteConfigObject()
dictConfig.s_NonSecureHostName
=mscsSiteCfg(Application("MSCSCommerceAppName")).Value.Fields("s_NonSecureHostName").Value
dictConfig.s_SecureHostName
=mscsSiteCfg(Application("MSCSCommerceAppName")).Value.Fields("s_SecureHostName").Value
Set Application("MSCSAppConfig") = mscsAppConfig
Set GetAppConfigObject = mscsAppConfig
Else
' Retrieve the AppConfig object from the Application object.
Set GetAppConfigObject = Application("MSCSAppConfig")
End If
End Function
*********/CODE**********
| |
| Ravi Shankar 2005-06-16, 5:50 pm |
| Hi Volf,
After either basket.RemoveItem() or setting the item qty to 0, you should
typically re_execute the basket pipeline and basket.save before requesting a
view That would recomput any discounts, totals and such.
"Volf Green" wrote:
> Hi,
>
> I need to modify order already stored in CS2002.
> I successfully modified bizdesk module, and added delete button after
> selecting a lineitem when viewing orderdetail.
>
> I have the specific ordergroup_id and lineitem_id.
>
> Can someone give me a piece of "asp" code to accomplish this?
>
> First I tried to use RemoveItem(), which removed the item, but when
> viewing the order from website, I got an index error, seemed like it
> still had the item stored somewhere...
>
> Secondly, I tried to set quantity of the lineitem to 0, that worked,
> but totals stayed same. I can't seem to find an example of how to run
> the pipeline/update the totals of the order.
>
> If someone can help me, I'd rather remove the lineitem from order
> completely.
>
> My code below is located in bizdesk asp page: "orderstatus_view.asp"
>
> Any help would be greatly appriciated(I've spend the whole day on
> this)
>
> Thanks,
> Mike
>
> *********CODE**********
> Dim oOrderGroup, sOrderGroupId, sNewOrderStatus, sLastName,
> sOrderFormName, m_UserId, dictContext
> sOrderGroupId = "{ADCDA4CE-7FE9-4618-BEA9-7979A6DFF5A7}"
> m_UserId = "{63F5E1FF-C2F9-48A9-B356-25F0C8C3FD9F}"
> sNewOrderStatus = 32
> sLastName = "Dork"
>
> Set oOrderGroup = GetOrderGroup(sOrderGroupId)
> Call oOrderGroup.LoadOrder(sOrderGroupID)
>
> Response.write "after Call oOrderGroup.LoadOrder(sOrderGroupID)"
>
> For Each sOrderFormName In oOrderGroup.Value.OrderForms
> 'Call mscsOrderGrp.PutOrderFormValue(sKey, sValue, sOrderFormName)
> Call oOrderGroup.PutOrderFormValue("order_status_code",
> sNewOrderStatus,sOrderFormName)
> Call oOrderGroup.PutOrderFormValue("user_last_name",
> sLastName,sOrderFormName)
> Call oOrderGroup.PutItemValue("quantity", 0, True,2,sOrderFormName)
>
> Next
>
>
> Call oOrderGroup.SaveAsOrder()
>
> Set dictContext = Server.CreateObject("Commerce.Dictionary")
> Set dictContext.CacheManager =
> Server.CreateObject("Commerce.CacheManager")
> dictContext.ShippingManagerCache = "Commerce.ShippingManagerCache"
>
>
> Call oOrderGroup.RunPipe(" C:\Inetpub\wwwroot\retail2002\Pipelines\
total.pcf",
> "Commerce.PooledPipeline", dictContext)
>
> Function GetOrderGroup(ByVal sOrderGroupID)
> Dim mscsOrderGrp, dictConfig
> Set dictConfig = GetConfigDictionary()
>
> Set mscsOrderGrp = Server.CreateObject("Commerce.OrderGroup")
> Call mscsOrderGrp.Initialize(dictConfig. s_TransactionsConnectionString,sOrderGro
upID)
> 'Call mscsOrderGrp.Initialize(dictConfig. s_TransactionsConnectionString,m_UserID)
> Set GetOrderGroup = mscsOrderGrp
> End Function
>
>
> Function GetConfigDictionary()
>
> Dim mscsAppConfig
>
> Set mscsAppConfig = GetAppConfigObject()
> Set GetConfigDictionary = mscsAppConfig.GetOptionsDictionary("")
> End Function
>
> Function GetAppConfigObject()
>
> Dim mscsAppConfig, mscsSiteCfg
>
> ' Is the AppConfig object stored in the Application object?
> If Not IsObject(Application("MSCSAppConfig")) Then
>
> ' Create and initialize the AppConfig object.
> Set mscsAppConfig = Server.CreateObject("Commerce.AppConfig")
> Call mscsAppConfig.Initialize(MSCSCommerceSiteName)
>
> ' Inject some special values into the configuration dictionary...
> Set dictConfig = mscsAppConfig.GetOptionsDictionary("")
> Set mscsSiteCfg = GetSiteConfigObject()
> dictConfig.s_NonSecureHostName
> =mscsSiteCfg(Application("MSCSCommerceAppName")).Value.Fields("s_NonSecureHostName").Value
> dictConfig.s_SecureHostName
> =mscsSiteCfg(Application("MSCSCommerceAppName")).Value.Fields("s_SecureHostName").Value
>
> Set Application("MSCSAppConfig") = mscsAppConfig
> Set GetAppConfigObject = mscsAppConfig
> Else
> ' Retrieve the AppConfig object from the Application object.
> Set GetAppConfigObject = Application("MSCSAppConfig")
> End If
> End Function
> *********/CODE**********
>
| |
| michal.tesar@gmail.com 2005-06-21, 7:59 am |
| Hi Ravi,
how do I re_execute basket pipeline in the above code?
Thanks,
Mike
| |
| Ravi Shankar 2005-06-21, 5:51 pm |
| Hi Mike,
I realized a little later that you're doing the modifications through the
BizDesk. Unfortunately the BizDesk does not have the pipelines or the
CommerceContext and is ASP based.. You can however setup the retail sample
site and take the code to create the order context and pipeline execution
code from there. It'd require some work through since you'd have to copy the
pipelines also into the bizdesk area apart from a chance that the user might
be accessing the same order object while you're modifying it.. and a whole
lot of such issues.
On a different note, it may be easier to not do order modification through
BizDesk. You could look at providing an admin interface on your site where
based on a specifc user type you could allow for order search and edit.. etc.
"michal.tesar@gmail.com" wrote:
> Hi Ravi,
>
> how do I re_execute basket pipeline in the above code?
>
> Thanks,
> Mike
>
>
| |
| michal.tesar@gmail.com 2005-06-22, 7:49 am |
| Hi Ravi,
thanks for your help. I finally got it working, (set up a webservice in
my site(retail2002) which takes 3 parameters: ordergroup_id, user_id,
lineitemindex and loads the order, removes the lineitem, runs
pipelines, saves the order). I call the webservice from bizdesk, after
selecting a lineitem in orderdetail.
Works well.
Mike
|
|
|
|
|