Rank: Member
  Joined: 8/13/2007(UTC) Posts: 15
  
 
     | 
    
        
            
	      
                Using the web services. Items on our web site have two choices, color and size. When I retrieve orders from the web site the line item provides the guid for generated choice for a specific color and size. From this guid what is the best way to determine what the two choices, color and size, are for this guid. I can see the choices in the description but would prefer to find the choices with some web service method for the passed guid in the order.  
  Thanks. 
            
  
         
     | 
    | 
         
             
     | 
    
         
            
         
     | 
    | 
        
     | 
            
        
            
        
            
            
    
        
Rank: Member
  Joined: 11/5/2003(UTC) Posts: 2,136
  Was thanked: 1 time(s) in 1 post(s)
  
 
     | 
    
        
            
	      
                Do you want the list of possible choices (e.g. "Red", "Green", "Blue"; and "Small", "Medium", "Large"), or the choices that were made (e.g. "Green" and "Small")?    | 
 | 
            
 
        
    
    | 
         
             
     | 
    
         
            
         
     | 
    | 
        
     | 
            
        
    
        
            
            
    
        
Rank: Member
  Joined: 8/13/2007(UTC) Posts: 15
  
 
     | 
    
        
            
	      
                I am looking for the choices for that guid, "Green" and "Small". 
            
  
         
     | 
    | 
         
             
     | 
    
         
            
         
     | 
    | 
        
     | 
            
        
            
        
            
            
    
        
Rank: Member
  Joined: 11/5/2003(UTC) Posts: 2,136
  Was thanked: 1 time(s) in 1 post(s)
  
 
     | 
    
        
            
	      
                Code: Dim service As New BVC5.WebServices3 
    
  Dim token As BVC5.AuthenticationToken 
  token = GetToken() ' Your code to login 
    
  Dim order As BVC5.Order 
  order = GetOrder() ' Your code that retrieves order 
    
  Dim lineitem As BVC5.LineItem 
  lineitem = order.Items(0) 
    
  Dim lineitemModifier As BVC5.LineItemModifier 
  lineitemModifier = lineitem.Modifiers(0) 
    
  Dim modifier As BVC5.ProductModifier 
  modifier = service.Catalog_ProductModifier_FindByBvin(token, lineitemModifier.ModifierBvin) 
    
  For Each option As BVC5.ProductModifierOption in modifier.ModifierOptions 
    If option.Bvin = lineitemModifier.ModifierValue Then 
      ' This is the matching option 
      Console.WriteLine(option.DisplayText) 
    End If 
  Next 
 
  Unfortunately there is no Catalog_ProductModifierOption.FindByBvin WebMethod, so you need to retrieve the entire ProductModifier and then examine the options to find the matching choice.  (I wrote the code on the fly...I apologize if there is a typo)    | 
 | 
            
 
        
    
    | 
         
             
     | 
    
         
            
         
     | 
    | 
        
     | 
            
        
    
        
            
            
    
        
Rank: Member
  Joined: 8/13/2007(UTC) Posts: 15
  
 
     | 
    
        
            
	      
                Thanks Andy, that looks like exactly what I need. Just out of curiousity how did you figure this out yourself? 
            
  
         
     | 
    | 
         
             
     | 
    
         
            
         
     | 
    | 
        
     | 
            
        
            
        
            
            
    
        
Rank: Member
  Joined: 11/5/2003(UTC) Posts: 2,136
  Was thanked: 1 time(s) in 1 post(s)
  
 
     | 
    
        
            
	      
                I don't recall. I wrote the code that this comes from last year (as part of Shipper Service for BVC5). Normally I look at the object first (i.e. ProductModifierOption) and then see what methods it has. In this case, I probably found that this was missing from WebServices3 and so I looked around at related objects until I found a solution.
  I have found the API to be 90% self-documenting. The other 10% I figure out by reading other code (such as the code behind the BVAdmin pages) or trial and error.    | 
 | 
            
 
        
    
    | 
         
             
     | 
    
         
            
         
     | 
    | 
        
     | 
            
        
    
        
            
            
    
        
Rank: Member
  Joined: 8/13/2007(UTC) Posts: 15
  
 
     | 
    
        
            
	      
                I tested out the code you suggested but for some reason there are no Modifiers. This array has a length of 0. Yet when I look at the order I can see the two choices I made when ordering the item. I also looked at Inputs and this array is empty as well. Any thoughts as to why these arrays are empty? 
            
  
         
     | 
    | 
         
             
     | 
    
         
            
         
     | 
    | 
        
     | 
            
        
            
        
            
            
    
        
Rank: Member
  Joined: 11/5/2003(UTC) Posts: 2,136
  Was thanked: 1 time(s) in 1 post(s)
  
 
     | 
    
        
            
	      
                The order objects that come back from a search are not fully hydrated. Try using Order_FindByBvin to retrieve the full order and examine that. For example (this is just pseudo code),
  for each lightOrder as Order in searchResults   heavyOrder = Order_FindByBvin(token, lightOrder.Bvin)   ' heavy Order should have all of the information next    | 
 | 
            
 
        
    
    | 
         
             
     | 
    
         
            
         
     | 
    | 
        
     | 
            
        
    
                           
    
        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.