Rank: Member
Joined: 11/21/2014(UTC) Posts: 66
|
The website provides gift certificates with customer selected amounts (in $25 increments). How do I provide this functionality using the web service?
How do I add the product to an order with the specified value?
|
|
|
|
Rank: Administration
Joined: 4/2/2004(UTC) Posts: 2,393 Location: Hummelstown, PA Thanks: 6 times Was thanked: 163 time(s) in 158 post(s)
|
Originally Posted by: tappedtech The website provides gift certificates with customer selected amounts (in $25 increments). How do I provide this functionality using the web service? A gift certificate is just another product so you add it as a line item to your order. Originally Posted by: tappedtech How do I add the product to an order with the specified value? I believe you just need to set the BasePrice property of the LineItem object. |
Aaron Sherrick BV Commerce Toll-free 888-665-8637 - Int'l +1 717-220-0012 |
|
|
|
Rank: Member
Joined: 11/21/2014(UTC) Posts: 66
|
I was adding products to the order via Orders_Order_AddItem_ByBvin().
Can I continue to use that and then: 1) Refresh the local order object 2) Find the gift certificate's line item in the order 3) Set the gift certificate's line item base price 4) Update the order via Orders_Order_Update()
Or do I need to create the line item and add it via Orders_Order_AddItem()? If i need to create the line item, what needs to be set?
|
|
|
|
Rank: Administration
Joined: 4/2/2004(UTC) Posts: 2,393 Location: Hummelstown, PA Thanks: 6 times Was thanked: 163 time(s) in 158 post(s)
|
Either way should work, but since you've already gotten the process dwn using the Orders_Order_AddItem_ByBvin method I would stick with that. |
Aaron Sherrick BV Commerce Toll-free 888-665-8637 - Int'l +1 717-220-0012 |
|
|
|
Rank: Member
Joined: 11/21/2014(UTC) Posts: 66
|
The first way I suggested (add the line item, refresh order, set base price, update order) isn't working. The base price after the refresh is $75 (site default).
Should I be updating the base price/order differently?
If not, what lineItem properties are required if I were to use Orders_Order_AddItem()?
|
|
|
|
Rank: Administration
Joined: 4/2/2004(UTC) Posts: 2,393 Location: Hummelstown, PA Thanks: 6 times Was thanked: 163 time(s) in 158 post(s)
|
Originally Posted by: tappedtech The first way I suggested (add the line item, refresh order, set base price, update order) isn't working. Updating the Order object won't update the child objects (e.g. LineItem). Why don't you just set the BasePrice property on the LineItem before you add it to the order? |
Aaron Sherrick BV Commerce Toll-free 888-665-8637 - Int'l +1 717-220-0012 |
|
|
|
Rank: Member
Joined: 11/21/2014(UTC) Posts: 66
|
Originally Posted by: Aaron Updating the Order object won't update the child objects (e.g. LineItem). Why don't you just set the BasePrice property on the LineItem before you add it to the order?
Maybe I wasn't clear enough, but that's what I was asking about in post #3. When creating the LineItem and adding it to the Order using Orders_Order_AddItem(), what LineItem properties need to be set?
|
|
|
|
Rank: Administration
Joined: 4/2/2004(UTC) Posts: 2,393 Location: Hummelstown, PA Thanks: 6 times Was thanked: 163 time(s) in 158 post(s)
|
Sorry, I forgot that you were using the Orders_Order_AddItem_ByBvin. In that case just update the line item and update it using Orders_LineItem_Update. If you want to use Orders_Order_AddItem you should set the following properties of the LineItem object:
- ProductId
- ProductName
- ProductShortDescription
- ProductSku
- BasePrice
- Quantity
Edited by user Monday, February 2, 2015 6:53:44 PM(UTC)
| Reason: Not specified |
Aaron Sherrick BV Commerce Toll-free 888-665-8637 - Int'l +1 717-220-0012 |
|
|
|
Rank: Member
Joined: 11/21/2014(UTC) Posts: 66
|
I created the line item and set the properties you specified, along with the user supplied base price. But after you add it to the order, the price is $75 (default) again.
This is how I added the item: //Get the gift certificate's product info WebServices3.Product productInfo = ws.Catalog_InternalProduct_FindByBvin(ref token, productBvin.ToString());
//Set the gift certificate's lineItem base price to reflect the requested amount WebServices3.LineItem giftCertLineItem = new WebServices3.LineItem(); giftCertLineItem.ProductId = productInfo.Bvin; giftCertLineItem.ProductName = productInfo.ProductName; giftCertLineItem.ProductShortDescription = productInfo.ShortDescription; giftCertLineItem.ProductSku = productInfo.Sku; giftCertLineItem.BasePrice = giftCardAmount; giftCertLineItem.Quantity = prodQuantity;
ws.Orders_Order_AddItem(ref token, order, giftCertLineItem)
I also tried adding the product by bvin, then updating the base price via Orders_LineItem_Update(). This worked but it's an issue when there are multiple gift certificates in the order (I was using the product's bvin to find the line item in the order).
Can I assume that the list of line items in the order are in the same sequence they were added?
If they are, I can just update the last lineItem in the order's array. (Assuming I change the base price immediately after adding the product/lineItem).
|
|
|
|
Rank: Member
Joined: 11/21/2014(UTC) Posts: 66
|
Any answers for my questions above?
|
|
|
|
Rank: Member
Joined: 10/28/2014(UTC) Posts: 11 Location: Hummelstown, PA Was thanked: 2 time(s) in 2 post(s)
|
Sorry for the delay.
It looks like you actually can't do it using Orders_Order_AddItem because the price is automatically reset to the default. I haven't tested it the other way (using Orders_LineItem_Update after adding the item), but you said that it worked, so that's probably how it will need to be done. I'm pretty sure that items that are added in BV will always be added sequentially, so that shouldn't be a problem. But something else you could do would be to manually set the bvin on the LineItem before you add it (using Guid.NewGuid().ToString()) and then look up the item using that bvin. That will guarantee that you are looking up the right product. |
Ryan Groene BV Commerce Toll-free 888-665-8637 - Int'l +1 717-220-0012 |
|
|
|
Rank: Member
Joined: 11/21/2014(UTC) Posts: 66
|
It's working now. I set the BVIN before adding the line item to make sure I was changing the correct product's base price.
Thank you, Ryan.
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.