Copied to clipboard

Flag this post as spam?

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


  • Rasmus Fjord 675 posts 1566 karma points c-trib
    Oct 15, 2012 @ 11:05
    Rasmus Fjord
    0

    Is it possible to reduce the whole order price?

    hey :)

    Our customer just asked if its possible to get an input field on an order where they could reduce the whole order price.

    The scenario is that they want to give a discount on the whole order. They will ofc go in manually to reduce the price in their payment provider on the order. So if they could "add an orderline" with a -xxx value or something like it. So that they can resend an order confirmation with a line saying "Discount".

    Is this possible ?

  • Anders Burla 2560 posts 8256 karma points
    Oct 15, 2012 @ 22:51
    Anders Burla
    0

    Hi Rasmus

    So this is in the admin part of Tea Commerce? Has the customer "paid" with credit card?

    Kind regards
    Anders

  • Rasmus Fjord 675 posts 1566 karma points c-trib
    Oct 16, 2012 @ 08:29
    Rasmus Fjord
    0

    Hey Anders : )

    Yeah its in the Teacommerce order view (teaCommerceAdminOrder). Yea its after the order is finialized and payed for. 

    But the payment is not a problem because our customer can always login to their creditcard dealer and lower the payment. 

    Its only meant to add a line inside the teacommerce order and make a reduction on the total order.

     

    Its not a function that will be used often i know, but if you want to give some discount for a client it should be there.

  • Anders Burla 2560 posts 8256 karma points
    Oct 16, 2012 @ 12:19
    Anders Burla
    0

    Well I think you need to make it this way then. Add the required UI in the AdminOrder.xslt. Now create a /base method that will add the discount order line. In this base method you need to check that the user is logged into the umbraco (security). You can do this with SessionController.HasAdminAccess. Now add the order line to the order in the C# code. Make some javascript in your xslt that calls the /base method and updates the UI. Should be it :)

    Kind regards
    Anders

  • Rasmus Fjord 675 posts 1566 karma points c-trib
    Oct 16, 2012 @ 14:06
    Rasmus Fjord
    0

    awesome ill give it a shot.

  • Rasmus Fjord 675 posts 1566 karma points c-trib
    Oct 17, 2012 @ 13:29
    Rasmus Fjord
    0

    im building the /Base func atm and its my first time touching Teacommerce.Data. But my question is about how to add the "discount".

    Im gussing I should use Order.CreateOrderLine(int nodeId, decimal quantity);

    But do I have to add a node named "discount" with a price of "1" and then use that NodeId and set the quantity to the "discount" ? 

     

    or is their any other ways to achive this ?

  • Anders Burla 2560 posts 8256 karma points
    Oct 17, 2012 @ 13:47
    Anders Burla
    0

    In the current version of Tea Commerce - you need an umbraco node as TC works with nodeId and the umbraco content. So create a discount node with a price of 0. Then add that orderline using the method you specified. Now you can change the quantity and price of that orderline.

    Kind regards
    Anders

  • Rasmus Fjord 675 posts 1566 karma points c-trib
    Oct 17, 2012 @ 14:01
    Rasmus Fjord
    0

    Arh okay :)

    Then i was on the right track :) 

    Thx.

  • Rasmus Fjord 675 posts 1566 karma points c-trib
    Oct 17, 2012 @ 14:24
    Rasmus Fjord
    0

    someone should hand you and your team a bottle of whiskey next time I see ya for making a topnotch product heh :)

  • Anders Burla 2560 posts 8256 karma points
    Oct 18, 2012 @ 09:33
    Anders Burla
    0

    Uhh sounds nice - its almost christmas - and we do accept gifts at the office address :p

    But its really nice done!

  • Rasmus Fjord 675 posts 1566 karma points c-trib
    Oct 18, 2012 @ 10:59
    Rasmus Fjord
    0

    Hmm but something is a bit off for me.

    It works like 20% of them time.

    Ive created some simple func that adds the discount as a unique orderline and then sets the UnitPrice(all other values seems to be read only) to the discount price. But its like that the unitprice is saved correctly.  

      public static void AddDiscount(long OrderId, decimal Discount, int DiscountNodeId)
            {
                //CHECK IF WE HAVE ACCESS RIGHTS
                if (SessionController.HasAdminAccess)
                {   
                    Order o = Order.GetOrder(OrderId);
                    OrderLine ol = o.CreateUniqueOrderLine(DiscountNodeId, 1);
                    ol.UnitPrice = -(Discount); 
                }

     

    All the values come into the base func just right the values are(not that it matters : )

    orderid : 170

    discount: 100

    dicountNodeId :1303

     

    And if i look in my stacktrace the "unitprice" is set to "-100"

    And the wierd part is that i have seen it working(the above screenshot)

    What am i missing ?

    (i have ofc made a func to remove all discount lines :) )

     

  • Rasmus Fjord 675 posts 1566 karma points c-trib
    Oct 18, 2012 @ 13:10
    Rasmus Fjord
    0

    Im gussing that i have to put it back into the order obj and save it or ? :)

  • Anders Burla 2560 posts 8256 karma points
    Oct 18, 2012 @ 13:11
    Anders Burla
    0

    If you change the order - you will have to save it :)

Please Sign in or register to post replies

Write your reply to:

Draft