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

Notification

Icon
Error

blueacorn
#1 Posted : Friday, September 7, 2007 7:58:49 AM(UTC)
blueacorn

Rank: Member

Joined: 6/27/2007(UTC)
Posts: 63

Ok, back to my inventory sync from another PHP based website. I've been successfully connecting to the webservices through PHP and getting the data back. But, the problem I'm running into is from more of a WebServices logic.

Here's the scenario:

From another PHP driven website, I need to sync inventory - or at least adjust the inventory on the BV site when an order is placed on the other site. The only mapping I have between both systems is the SKU of the product. So when an order is placed on the PHP site, here are the steps I take in logic against the BV Webservices:

(1) Establish Login Token
(2) Query Webservices for bvin of product based on SKU (Catalog_InternalProduct_FindBySku)
(3) Get bvin of the product size option (in the result of #2)
(4) Adjust the inventory (Catalog_ProductInventory_AdjustAvailableQuantity)

Here's the problem:
Each product has one product choice - size, and each size has their own inventory. So the inventory I need to adjust is actually for a child product of the parent (in terms of how they're setup in the db). So for example, in step #2, my SKU may be 1100 for the parent product, but for size M it would be 1100-M. If I try to pass 1100-M in step 2 I get no results back (when in fact it does exist in the db) - but if I pass in 1100 I do get results. My guess is that this method only looks up products with no parentid in the db? The results that come back from the 1100 sku contain the product choices, and the bvin of the product choice but I have no way of associating that to a product bvin to get the inventory of that size.

So, I cannot get the bvin of the child sku and thus cannot adjust the inventory on it. I realize this is a bit confusing to explain, so I'm hoping someone at BV - or someone who knows the data structure behind BV and the WS - understands and can help me out with this logic. Thanks
Andy Miller
#2 Posted : Friday, September 7, 2007 12:44:06 PM(UTC)
Andy Miller

Rank: Member

Joined: 11/5/2003(UTC)
Posts: 2,136

Was thanked: 1 time(s) in 1 post(s)
Whenever I'm not sure how to retrieve or update some piece of information, I turn to the BVAdmin pages. In this case, I used BVAdmin > Catalog > Products to edit a product in my catalog with a choice (RED1). Then I clicked on the Inventory link to load BVAdmin/Catalog/Products_Edit_Inventory.aspx. This page shows all the SKU's (RED1A, RED1B, etc) and lets me edit the individual inventories.


This seems to do what you want, so then I opened the codebehind file to see how they do it.



The Page_Load calls LoadInventory. LoadInventory calls Catalog.InternalProduct.FindByBvin(productBvin) to load the main product, then calls Catalog.InternalProduct.FindChildren(productBvin) to load the child products.



So it looks like you should do something like this via web services to load the inventory:



1. Use Catalog_InternalProduct_FindBySku to get the main product.

2. Use Catalog_InternalProduct_FindChildren to get the child products.



The page also updates the inventory. Take a look at the Save method to see how it is done. Note that quite a bit of business logic and even some data-housekeeping logic is in that method. You will need to do the same via web services.
Andy Miller
Structured Solutions

Shipper 3 - High Velocity Shipment Processing
jasonhick70
#3 Posted : Friday, November 2, 2007 4:43:12 AM(UTC)
jasonhick70

Rank: Member

Joined: 7/3/2007(UTC)
Posts: 79

Great tip! Thanks Andy :D

I've been trying to do just this and have now got it working.

Regards,

Jason
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