|
Home > Archive > Commerce Server General > November 2005 > Values in OrderGroup table
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 |
Values in OrderGroup table
|
|
| Martin 2005-11-29, 5:55 pm |
| Hi,
I'm trying to import orders from our back office system onto the web
site.
(Alternatively - suggest any better way of accomplishing this)
To do this, I'm creating a new ordergroup object for a user and adding
the items and various other orderform values onto it.
It seems to be working fairly well, however. The following are not
being saved onto the ordergroup table and it's really starting to annoy
me:
saved_cy_total_total, cy_oadjust_subtotal
And the main one: order_number !!!!?
Why will it not let me apply an order number then save it? The
documentation says that if there is a tracking number this is left,
however this is a plain lie, as it just removes it and adds it's own.
HOW do I get these values to save onto the ordergroup. Are there any
items I need to set to the form to trick it into copying across? Is
there a particular command i should use..?
Here's my code: (ish) Any help/suggestions please.
'Load an ordergroup for this user
Set objOrderGroup = LoadBasket(s_id)
'Add a command here to save their current basket as a template
sCurID = objOrderGroup.SaveAsTemplate(s_id & "TempTrans")
'Clear this ordergroup
objOrderGroup.clear
'Loop through the order line items which will create
'and add them to the default order form.
Do While Not rsOrder.eof
Set dictItem = Server.CreateObject("Commerce.Dictionary")
dictItem.product_catalog = "Products"
dictItem.product_catalog_base = "Products"
dictItem.product_id = rsOrder("product_id")
dictItem.cy_unit_price = rsOrder("cy_unit_price")
dictItem.cy_lineitem_total = rsOrder("cy_lineitem_total")
dictItem.description = rsOrder("description")
dictItem.Quantity = rsOrder("quantity")
dictItem.product_category = "Products"
dictItem.vendorID = "Products"
Call objOrderGroup.AddItem(dictItem)
rsOrder.moveNext
loop
rsOrder.moveFirst
'Add the order number
Call objOrderGroup.PutOrderFormValue("billing_currency", "USD")
Call objOrderGroup.PutOrderFormValue("order_number", sNum)
Call objOrderGroup.PutOrderFormValue("saved_order_number", sNum)
Call objOrderGroup.PutOrderFormValue("saved_cy_total_total",
cyTotal)
Call objOrderGroup.PutOrderFormValue("saved_cy_oadjust_subtotal",
cySub)
'Add the addresses onto the ordergroup
Call AddAddresses(cnnCS,objOrderGroup)
Call objOrderGroup.SaveAsOrder()
| |
| Jeff Lynch 2005-11-29, 5:55 pm |
| This is just my opinion but I would NOT attempt to import ERP system orders
directly into the CS2002 tables. These tables are designed to be accessed by
the CS2002 runtime APIs or if you are using FP1, the web service APIs.
If you are looking to show "open orders" from your ERP system on your CS web
site it's probably easier to import these orders into a SQL database and
then use ADO.NET to retrieve the orders and ASP.NET server controls to
display the orders.
Having said that, in CS2006 you WILL be able to import ERP orders into
Commerce Server using the new BizTalk Adapters.
--
Jeff Lynch
"Ramblings From A [Microsoft] Connected Universe"
http://codebetter.com/blogs/jeff.lynch
"Martin" <bigmarts@hotmail.com> wrote in message
news:1133276717.835195.138890@g43g2000cwa.googlegroups.com...
> Hi,
>
> I'm trying to import orders from our back office system onto the web
> site.
>
> (Alternatively - suggest any better way of accomplishing this)
>
> To do this, I'm creating a new ordergroup object for a user and adding
> the items and various other orderform values onto it.
>
> It seems to be working fairly well, however. The following are not
> being saved onto the ordergroup table and it's really starting to annoy
> me:
>
> saved_cy_total_total, cy_oadjust_subtotal
>
> And the main one: order_number !!!!?
>
> Why will it not let me apply an order number then save it? The
> documentation says that if there is a tracking number this is left,
> however this is a plain lie, as it just removes it and adds it's own.
>
> HOW do I get these values to save onto the ordergroup. Are there any
> items I need to set to the form to trick it into copying across? Is
> there a particular command i should use..?
>
> Here's my code: (ish) Any help/suggestions please.
>
>
>
> 'Load an ordergroup for this user
> Set objOrderGroup = LoadBasket(s_id)
>
> 'Add a command here to save their current basket as a template
> sCurID = objOrderGroup.SaveAsTemplate(s_id & "TempTrans")
>
> 'Clear this ordergroup
> objOrderGroup.clear
>
> 'Loop through the order line items which will create
> 'and add them to the default order form.
> Do While Not rsOrder.eof
> Set dictItem = Server.CreateObject("Commerce.Dictionary")
> dictItem.product_catalog = "Products"
> dictItem.product_catalog_base = "Products"
> dictItem.product_id = rsOrder("product_id")
> dictItem.cy_unit_price = rsOrder("cy_unit_price")
> dictItem.cy_lineitem_total = rsOrder("cy_lineitem_total")
> dictItem.description = rsOrder("description")
> dictItem.Quantity = rsOrder("quantity")
> dictItem.product_category = "Products"
> dictItem.vendorID = "Products"
>
> Call objOrderGroup.AddItem(dictItem)
> rsOrder.moveNext
> loop
>
> rsOrder.moveFirst
>
> 'Add the order number
> Call objOrderGroup.PutOrderFormValue("billing_currency", "USD")
> Call objOrderGroup.PutOrderFormValue("order_number", sNum)
> Call objOrderGroup.PutOrderFormValue("saved_order_number", sNum)
> Call objOrderGroup.PutOrderFormValue("saved_cy_total_total",
> cyTotal)
> Call objOrderGroup.PutOrderFormValue("saved_cy_oadjust_subtotal",
> cySub)
>
>
> 'Add the addresses onto the ordergroup
> Call AddAddresses(cnnCS,objOrderGroup)
>
> Call objOrderGroup.SaveAsOrder()
>
| |
| Martin 2005-11-29, 8:48 pm |
| Hmm, thanks.
I kinda am using the commerce server APIs.
Just pretend that the data was coming from the site, not a DB table. I
still can't get the order_number to apply to a basketgroup then persist
through to the ordergroup table (without re-writing it after the order
is saved)
Also still have trouble with the totals being written to the ordergroup
table unless I re-run the total pipeline... Is this setting a avalue I
need to put on my orderform to trick it into seeing it as a full
order....?
| |
| Jeff Lynch 2005-11-30, 5:52 pm |
| You'll need to run each order through a CS pipeline in order to set these
values correctly. I can't think of any other "supported" method to
accomplish this.
--
Jeff Lynch
"Ramblings From A [Microsoft] Connected Universe"
http://codebetter.com/blogs/jeff.lynch
"Martin" <bigmarts@hotmail.com> wrote in message
news:1133311206.892923.124140@g44g2000cwa.googlegroups.com...
> Hmm, thanks.
>
> I kinda am using the commerce server APIs.
>
> Just pretend that the data was coming from the site, not a DB table. I
> still can't get the order_number to apply to a basketgroup then persist
> through to the ordergroup table (without re-writing it after the order
> is saved)
>
> Also still have trouble with the totals being written to the ordergroup
> table unless I re-run the total pipeline... Is this setting a avalue I
> need to put on my orderform to trick it into seeing it as a full
> order....?
>
| |
| Ravi Shankar 2005-11-30, 5:52 pm |
| Hi Martin,
It is not very clear from your code which version of CS you're working with
(however from how you're creating lineitems it looks Interop & CS 2000) or
whether you're using the Interop or BCL assemblies.
If you're using BCL (Commerce Server 2002) then once you save the basket you
get a reference to the PurchaseOrder object which has a "TrackingNumber"
property to load the Order_number.. remember to do a purchaseorder.save after
this. 
If you're using PIA (Commerce Server 2000) then the ordergroup.saveasorder
has a parameter you can pass (vTrackingNumber) (REFER:
http://msdn.microsoft.com/library/d...roup_lsnv_c.asp)
which would help you save the order_number into the system.
Regarding setting the saved_ variables... then
ordergroup.orderforms("default").value("saved_..) = value will get the value
persisted at the orderform level. 
Hope this helps.
--
Ravi Shankar
"Martin" wrote:
> Hi,
>
> I'm trying to import orders from our back office system onto the web
> site.
>
> (Alternatively - suggest any better way of accomplishing this)
>
> To do this, I'm creating a new ordergroup object for a user and adding
> the items and various other orderform values onto it.
>
> It seems to be working fairly well, however. The following are not
> being saved onto the ordergroup table and it's really starting to annoy
> me:
>
> saved_cy_total_total, cy_oadjust_subtotal
>
> And the main one: order_number !!!!?
>
> Why will it not let me apply an order number then save it? The
> documentation says that if there is a tracking number this is left,
> however this is a plain lie, as it just removes it and adds it's own.
>
> HOW do I get these values to save onto the ordergroup. Are there any
> items I need to set to the form to trick it into copying across? Is
> there a particular command i should use..?
>
> Here's my code: (ish) Any help/suggestions please.
>
>
>
> 'Load an ordergroup for this user
> Set objOrderGroup = LoadBasket(s_id)
>
> 'Add a command here to save their current basket as a template
> sCurID = objOrderGroup.SaveAsTemplate(s_id & "TempTrans")
>
> 'Clear this ordergroup
> objOrderGroup.clear
>
> 'Loop through the order line items which will create
> 'and add them to the default order form.
> Do While Not rsOrder.eof
> Set dictItem = Server.CreateObject("Commerce.Dictionary")
> dictItem.product_catalog = "Products"
> dictItem.product_catalog_base = "Products"
> dictItem.product_id = rsOrder("product_id")
> dictItem.cy_unit_price = rsOrder("cy_unit_price")
> dictItem.cy_lineitem_total = rsOrder("cy_lineitem_total")
> dictItem.description = rsOrder("description")
> dictItem.Quantity = rsOrder("quantity")
> dictItem.product_category = "Products"
> dictItem.vendorID = "Products"
>
> Call objOrderGroup.AddItem(dictItem)
> rsOrder.moveNext
> loop
>
> rsOrder.moveFirst
>
> 'Add the order number
> Call objOrderGroup.PutOrderFormValue("billing_currency", "USD")
> Call objOrderGroup.PutOrderFormValue("order_number", sNum)
> Call objOrderGroup.PutOrderFormValue("saved_order_number", sNum)
> Call objOrderGroup.PutOrderFormValue("saved_cy_total_total",
> cyTotal)
> Call objOrderGroup.PutOrderFormValue("saved_cy_oadjust_subtotal",
> cySub)
>
>
> 'Add the addresses onto the ordergroup
> Call AddAddresses(cnnCS,objOrderGroup)
>
> Call objOrderGroup.SaveAsOrder()
>
>
|
|
|
|
|