• Toll-free  888-665-8637
  • International  +1 717-220-0012
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

tappedtech
#1 Posted : Saturday, January 24, 2015 3:11:15 PM(UTC)
tappedtech

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?
Aaron
#2 Posted : Monday, January 26, 2015 9:01:06 AM(UTC)
Aaron

Rank: Administration

Joined: 4/2/2004(UTC)
Posts: 2,381
United States
Location: Hummelstown, PA

Thanks: 6 times
Was thanked: 163 time(s) in 158 post(s)
Originally Posted by: tappedtech Go to Quoted Post
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 Go to Quoted Post
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
tappedtech
#3 Posted : Monday, January 26, 2015 4:29:41 PM(UTC)
tappedtech

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?
Aaron
#4 Posted : Monday, January 26, 2015 5:39:20 PM(UTC)
Aaron

Rank: Administration

Joined: 4/2/2004(UTC)
Posts: 2,381
United States
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
tappedtech
#5 Posted : Wednesday, January 28, 2015 6:10:43 PM(UTC)
tappedtech

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()?
Aaron
#6 Posted : Monday, February 2, 2015 10:56:11 AM(UTC)
Aaron

Rank: Administration

Joined: 4/2/2004(UTC)
Posts: 2,381
United States
Location: Hummelstown, PA

Thanks: 6 times
Was thanked: 163 time(s) in 158 post(s)
Originally Posted by: tappedtech Go to Quoted Post
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
tappedtech
#7 Posted : Monday, February 2, 2015 1:02:52 PM(UTC)
tappedtech

Rank: Member

Joined: 11/21/2014(UTC)
Posts: 66

Originally Posted by: Aaron Go to Quoted Post
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?
Aaron
#8 Posted : Monday, February 2, 2015 6:53:05 PM(UTC)
Aaron

Rank: Administration

Joined: 4/2/2004(UTC)
Posts: 2,381
United States
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
tappedtech
#9 Posted : Tuesday, February 3, 2015 5:48:56 PM(UTC)
tappedtech

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).
tappedtech
#10 Posted : Wednesday, February 11, 2015 5:20:28 PM(UTC)
tappedtech

Rank: Member

Joined: 11/21/2014(UTC)
Posts: 66

Any answers for my questions above?
Ryan Groene
#11 Posted : Saturday, February 14, 2015 12:50:00 AM(UTC)
Ryan Groene

Rank: Member

Joined: 10/28/2014(UTC)
Posts: 11
United States
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
tappedtech
#12 Posted : Sunday, February 22, 2015 2:43:04 PM(UTC)
tappedtech

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.

©2024 Develisys. All rights reserved.
  • Toll-free  888-665-8637
  • International  +1 717-220-0012