Script help

 

I have a script set up to change open orders


I have this bit done and works ok which ignores certain shipping settings and exits the script


//Load the stock item details
        order.LoadStockItemDetails();
         
        //Set the postal service to the first order items' postal service
        string postal_service = order.OrderItems[0].StockItemDetails.PostalService;
         
        //Go through each order item1
        if (order.ShippingMethod == "PH Next Day")
          {
          return;
          }         
          if (order.ShippingMethod == "Yodel 24")
          {
          return;
          }
          if (order.ShippingMethod == "Amazon Logistics only")
          {
          return;
          }
          foreach (OrderItem oi in order.OrderItems)
        {
        //If it's the 2nd or more order item, and the postal service
        //is not equal to the first item's postal service, we exit the script
        if (postal_service != oi.StockItemDetails.PostalService)
        {
        return;
        }
        }order.Save(0);



on a open order if you right click and look at the XML data, you have a field under OrderWithItems and then ShipServiceLevel  


if this field ShipServiceLevel = UK Next I want it to ignore my script


so I have tried to change the line from


if (order.ShippingMethod == "Amazon Logistics only")


to


if (order.ShippingMethod == "Amazon Logistics only" && order.ShipServiceLevel == "UK Next")


but it is unable to find the order.ShipServiceLevel


how do I pick up this field ShipServiceLevel (may be I need a linking?)


Regards


Paul



Hi Paul,


I trust that you have obtained help by now for scripting.


If in future you encounter any further problems or need any assistance with scripting, do feel free to get in touch.


Thanks,

Regards.


Adrian

eBusiness Guru


T: +44(0) 207 096 5012
E: adrian@ebusinessguru.co.uk





Login to post a comment