Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Nigel Wilson 945 posts 2077 karma points
    Nov 01, 2012 @ 23:05
    Nigel Wilson
    0

    Update Shipping Cost Using .NET API

    Hi Rune

    We have the need to change the shipping fee on an order frmo an XML feed from our supplier.

    I am calculating the total (freightTotal) and then trying to update the order as follows:

    o.ShippingFee = Convert.ToDecimal(freightTotal);
    o.Save();

    This does update the "ManipulateShippingFeeWithoutVAT" field however does not update the primary shipping fee field (and all the other order totals).

    Are you able to advise how to achieve this please ?

    Thanks, Nigel

  • Rune Grønkjær 1372 posts 3103 karma points
    Nov 02, 2012 @ 08:06
    Rune Grønkjær
    0

    Hi Nigel,

    What you are doing is absolutely correct. Normally I calculate the shipping fee without VAT though and add it like this:

    order.ShippingFeeWithoutVAT = totalShippingPriceWithoutVAT;
    order.Save();

    This will set the shippingfee (just like you are doing) and is currently running on a couple of my own Tea Commerce solutions.

    ShippingFee and ShippingFeeWithoutVAT will return the manipulated shipping fee if you have provided a custom shipping price. If however the order is already finalized it will return the TransactionShippingFee. This is because when the order have been pay for and finalized Tea Commerce will freeze it so it can no longer be changed.

    Remember that the OriginalShippingFeeWithoutVAT will always contain the default fee, which you can use if you need it.

    To sum it up, you are not doing anything wrong, so your code should actually work.

    /Rune

  • Nigel Wilson 945 posts 2077 karma points
    Nov 02, 2012 @ 19:03
    Nigel Wilson
    0

    Hi Rune

    Thanks for your great feedback - you have always been very helpful...

    The order is finalised so that confirms why the ShippingFee isn't updating.

    Once the shipping fee is updated I generate an invoice (all orders are on account) and so will now tidy this up by getting the manipulatedshippingfee amount and performing my calculations from that.

    I guess it does mean that the historical data in the webshop will never reconcile to the invoice I have created... Something I am sure we can live with.

    Cheers again, Nigel

  • Nigel Wilson 945 posts 2077 karma points
    Nov 04, 2012 @ 20:32
    Nigel Wilson
    0

    Hi Rune

    OK, so we can't live with it - I have explained the issues and we need to update the order with the amended shipping fee.

    The solution, I belive, will be to run a sql query on the TeaCommerce_Order table to update the order details.

    So from what I can tell all I should only have to change are TransactionPaymentAmount & TransactionShippingFeeWithoutVAT within the orders table.

    Then run an o.Save() to refresh the XML cache and magically the XML should be all updated.

    Is this correct?

    Cheers, Nigel

  • Rune Grønkjær 1372 posts 3103 karma points
    Nov 05, 2012 @ 08:01
    Rune Grønkjær
    0

    Hi Nigel,

    No that won't work. The xml cache will not be updated before the cached object is removed from the cache. The database is updated from the cache, not the other way round.

    If you need to set some kind of TransactionPaymentAmount & TransactionShippingFeeWithoutVAT BEFORE the order is finalized you can allways use the order properties and set them there. If you do this in your server side code you will have the options to make the property read only, which means it cannot be overwritten from the client side. If you want to hide the property from the client you can also set it to serverside only, in which case the client side will not even know it exists.

    /Rune

  • Nigel Wilson 945 posts 2077 karma points
    Nov 05, 2012 @ 09:31
    Nigel Wilson
    0

    Hi Rune

    Well that is a bit of a speed bump then... 

    To provide some additional background:

    Orders are on account.
    I have to provide a freight estimate at the time of completing an order - this I am doing via a custom method with several calculations.
    The order details are transferring via XML file to a third party.
    Once the order is completed they send us an XML file to advise and to confirm the actual freight cost.
    We then generate an invoice from the website with the confirmed amounts. We also provide online access to historical orders. 

    I then was wanting to update the order with the confirmed freight cost - this I can get saved into the manipulated freight field, but not the actual shipping cost field. 

    I totally accept your websites functionality and as we are 100% committed to using your product, the only option I see is:

    1. Save the confirmed freight amount into the manipulated frieght field.
    2. Amend the invoice to use the manipulated freight total.
    3. Amend the customer facing order page so that it also uses the manipulated freight total for completed orders.

    The only aspect not covered is the admin area where you can view orders - ideally this needs to be changed so that it reflects the freight amount depending on the order status - manipulated value is the order is completed, the estimated value for all order status.

    Whilst I appreciate this would be changing the package code, I think we will need to change it. Is there a way I can author some custom functionaoity for the admin view so that the shipping amount shown for completed orders is the manipulated value ?

    Cheers, Nigel

Please Sign in or register to post replies

Write your reply to:

Draft