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 08, 2012 @ 14:45
    Rasmus Fjord
    0

    In need to update the quantity after "AddOrderLine"

    Hey Tom :) 

    Our customer has discovered something quite wierd that I hope you can help with :) Just like you helped with the other problems.

    So the issue is a bit complex to desribe so I will use some screenshots and such.

    I have created a product where the price is 125 as a standard price. and we a shipping fee of 60.

    And in your awesome product ive made a price reduction that looks like this : 

    So that means our prices looks like this :

     

    So far so good. 

    When we select a quantity of 3, 4, 5 in the dropdown.

    The code submitting it looks like this : 

    <form name="AddToBasket" action="/tcbase/teacommerce/SubmitForm.aspx" method="post">
                <input name="ReturnUrl" type="hidden" value="/da/netbutik/flow/din-indkoebskurv.aspx">
               <input name="AddOrderLine" type="hidden" value="nodeId,quantity">
                <input type="hidden" name="quantity" class="quantity" value="3">
                <input type="hidden" name="nodeId" value="1185">
                <button type="submit" class="button ctaButton simple ">Læg i kurv</button>
            </form>

    And this works in the basket:

    But if i go into teacommerce and find the order it will look like this : 

    It should say 360. Since 3x product is 300 + shipping (60) = 360.

    But instead it becomes 435. which is 3x 125(org price) + shipping (60).

    But if we then update the quantity of the line in the basket to 4 and then decrease it to 3 again we get this result : 

    360, like it should be.

    Its teacommerce 1.4.3.1 and umbraco 4.7.2 I havnt modified the project tough you send it to me so its still your version running, nothing is changed. Its quite bad because that price 435 is the one they pay and such.

     

     

  • Tom Smith 98 posts 172 karma points
    Oct 09, 2012 @ 11:47
    Tom Smith
    0

    Hi Rasmus,

    I had a look into this last night and couldn't seem to replicate the issue,

    In the tea commerce demo webshop, it appears as though adding products to the basket is achieved slightly differently (with Javascript) which might have something to do with it?; 

    /*
        Add orderline is called using the Tea Commerce javascript API
        We subscribe to the return events to be able to update the
        css class of the button.
        */
        TeaCommerce.addOrderLine(productid, quantity,
        {
          async: true,
          successfn: function (data) {
            //A timeout is set to show the user that the product has been added
            removeAddButtonUpdate(jQEle, localSubmitTimer);
          },
          errorfn: function (data) {
            //Something went wrong. We should handle it here
            removeAddButtonUpdate(jQEle, localSubmitTimer);
          }
        });
    

    This successfully triggers the WebshopEvents.OrderLineAdded event on the server, which is what the Price Breaks hook into?

    Is this method definately being called as part of your form submission? The same method appears to be called on the basket page when the quantity is updated, which could explain why it then works after changing the quantity on the basket page?

    Many Thanks,

    Tom

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

    Ive tried to do it where im adding it using javascript instead and im stilling getting the same result. I forgot to mention that im running with the new changes you made for me because of the breaking changes from teacommerce if that helps in anyway.

  • Tom Smith 98 posts 172 karma points
    Oct 09, 2012 @ 19:15
    Tom Smith
    0

    Hi Rasmus,

    I'm also using the latest version of the package so it shouldn't be anything to do with the changes. (These were mainly updates to how the prices were fetched from umbraco)

    Can you verify that the WebshopEvents.OrderLineAdded event is being fired server side when you are submitting the form and adding products to the basket? Something like the following should do it;

    using TeaCommerce.Data.Extensibility;
    using TeaCommerce.Data;
    using System.Linq;
    using System.Collections.Generic;
    using umbraco.BusinessLogic;
    
    namespace CogworksPriceBreaksForTeaCommerce
    {
        public class TeaCommerceEvents : ITeaCommerceExtension
        {
    
            #region ITeaCommerceExtension Members
    
            //The Initialize method lets you subscribe to all Tea Commerce events
            public void Initialize()
            {
                WebshopEvents.OrderLineAdded += WebshopEvents_OrderLineAdded;
            }
    
            #endregion
    
            void WebshopEvents_OrderLineAdded(Order order, OrderLine orderLine)
            {
                umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Custom, -1, "OrderLineAdded Event Fired");
            }
        }
    }
    

    Then check the Umbraco Log db table and see if there is an entry in there?

    Many Thanks,

    Tom

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

    Ey tom I did this : 

    And ive tried to add a product, and it hits the event just fine and throws in the log 

    iduserIdNodeIdDatestamplogHeaderlogComment

    53390-12012-10-10 08:21:46.300CustomOrderLineAdded Event Fired

     

     

  • Tom Smith 98 posts 172 karma points
    Oct 10, 2012 @ 11:51
    Tom Smith
    0

    Hi Rasmus,

    Thanks for the update, I can replicate the issue now,

    This only seems to be happening with incomplete orders for me. If the order is completed (i.e. progresses beyond the "Cart" order stage), then it all works as expected. 

    Additionally, if I click on the incomplete order in the backend to view it's full details, the full details screen is correct. 

    So it seems like it's only an issue with the Order listing page for orders in the "Cart" stage.

    Are you seeing the same behaviour at your end?

    Many Thanks,

    Tom

     

     

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

    You are right. 

    When i click an order it shows the details just as it use to be. 

    I havnt checked with it when i progress beyond cart, the only thing ive checked is that paying customers have put down their payment with the wrong price without the discount.

    I will check it out hopefully later today.

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

    But isnt it going from CART to Complete first when the payment is put down ? That means that it will give the wrong info to the payment service.

  • Tom Smith 98 posts 172 karma points
    Oct 10, 2012 @ 13:12
    Tom Smith
    0

    Hi Rasmus,

    I'm using the out of the box PayPal payment provider, 

    Once the payment is made, the order stage is updated from "Cart" to "Order"and the payment status becomes "Initial". Once the payment is captured, the payment status becomes "Captured"

    The amount is being sent over to PayPal correctly for me, but I think there is definately something fishy going on. 

    I think I'm going to need to register the code to run on more than one event, but until I can find out exaclty where the error is occuring, I'm not sure which events to register it on.

    I'll get back to you as soon as I find out anything more. Let me know if you discover any more info in the mean time,

    Apologies,

    Tom

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

    Ey Tom its np :) better that we get it cleared of bugs together :) 

    I use the default epay provider.

    im doing some assignments that needs to be done asap but afterwards ill check the things you have discovered to support it. 

  • Tom Smith 98 posts 172 karma points
    Oct 11, 2012 @ 12:55
    Tom Smith
    1

    Hi Rasmus,

    I think I have a fix,

    Please could you try this version of the DLL?

    https://www.dropbox.com/sh/7rlg2outs91c17t/qZrQp1d4cy/CogworksPriceBreaksForTeaCommerce.zip

    If this works for you, I'll release it as a new version of the package. It also now supports product variants, as long as the variants exist directly under the product in the content tree, and use the same NodeTypeAlias (as in demo webshop)

    Many Thanks,

    Tom

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

    you are a champ tom ill take it for a spin straight a way! 

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

    First tests its working so far. Ill test the extra feature you wrote about :)=

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

    For me it seems to be working ! :D happy happy happy !

    About the variants then we have a bit of another setup dunno if you can support that aswell :)

    But ill try to describe it.

    We have just done a golf shop for a customer :

    http://bjbettergolf.com/da/netbutik/produkter/golftilbehoer/tees/pride-professional-tee-system.aspx

    And at the moment there is 3 for x price but you cannot add 3 different variants and get the discount.

    But we have done a bit different variant system since they have ALOT of variants on some products. 

    Actually all "variants" is just the same product added with a "addUniqueOrderLine".

    The variants are defined as a node for each variantion and added to the product with a MNTP, then when a customer adds a product with variations we use addUniqueOrderLine and throw the selected variants as properties to the orderline.

    I know its a unique situation but could that be configured like with a line in a .config or something ?

     

  • Tom Smith 98 posts 172 karma points
    Oct 15, 2012 @ 12:19
    Tom Smith
    0

    Hi Rasmus,

    OK - I started work on Version 2.0 last week that should support this, I'll let you know as soon as I have a beta version ready for test.

    In the mean time, just to see if I understand correctly,

    Each order line in the basket corresponds to one unique product, but variants of this product may be added as properites to the order line. The order line quantity is therefore the sum of the number of varients added? Asuming the vairents all inherit their price from the master product, the standard logic - i.e. look up inheritance levels until price is found, then use quantity of orderLine to calculate - should work? 

    Or are we looking at trying to apply the discount accross multiple order Lines?

    Many Thanks,

    Tom

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

    Hey Tom again awesome for taking your time and doing this :)

    Ill explain it here just forget what i wrote in the above post, its was just to try an show how we build variants in a different way :)

    First of all, ALL the variants has no effect on the price.

     

    The usecase where the pricebreak dosnt work at the moment is this : 

    We have a product, http://bjbettergolf.com/da/netbutik/produkter/golftilbehoer/tees/pride-professional-tee-system.aspx where we have a pricebreak if we buy 3 product or more.

    There is also some variants of this products, and i want to order 2 x "Rød 53mm" and 1 x "blå 83 mm" but when we do this the pricebreak is not calculated.

    When i start by adding 2 x "Rød 53mm" to the basket, what is actually happening is that the Teacommerce function "addUniqueOrderLine" is used with a product/node ID of 2898 and along in the function the "variant" selection is sent along using the properties field. The "variant" send along is just a text line saying that its the "Rød 53mm" that i have selected. 

    Next I go back to the product page and I now add 1 x "blå 83 mm". Just like before he Teacommerce function "addUniqueOrderLine" is used with a product/node ID of 2898, because its basicly the product is same node as the previous just where i send along some other properties.

     

    So to try and answer your question i think we are looking on applyin' discount accross multiple order lines. From my point of view what has to been done is when an orderline is added/changed it should check the other orderlines to see if any of the other lines share its node id.

    Sorry if im confusing you :) if it helps we can take a quick skype session where i show you the backend and how we have accomplished it.

     

  • Tom Smith 98 posts 172 karma points
    Oct 15, 2012 @ 13:07
    Tom Smith
    0

    Hi Rasmus,

    I think that's pretty clear now. No worries, I'll build an option in to apply accross all orderLines. 

    The logic is now getting faily complicated, so I don't think I'll have the next version for you until this time next week. I'll get in touch if I have any more questions in the mean time!

    Many Thanks,

    Tom

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

    Awesome Tom! 

    No worries on the timeline :)

  • Tom Smith 98 posts 172 karma points
    Oct 17, 2012 @ 12:21
    Tom Smith
    0

    Hi Rasmus,

    Version 2.0 beta of the package is now ready for testing :)

    You can download it here: https://www.dropbox.com/sh/7rlg2outs91c17t/9OwXeyMgc3/CogworksPriceBreaksForTeaCommerce_2.0_Beta.zip

    It will add a new config file to the config folder called priceBreaks.config. For your usecase, you will need to set UseAdvancedVariantsMode to true. The config file is cached, so you will need to touch the web config / restart the app after doing this.

    Let me know how you get on?

    Many Thanks,

    Tom

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

    Awesome Tom ill take it for a spin today or tomorrow ! 

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

    Hey 

    something is failing. 

    here is what ive done, ive copied the config into /config and dll to bin ofc.

    Then i went into the config and set it up like this(yellow is the fields ive changed) : 

     

    Nothing is changed on the datatype from default(ive only opened it to check that alias and such was corrosponding with the config)

    Then i just saved a " " into the web.config til get it to restart the solution.

    After this i went into my node just to check it still had its value and such. 

    When i then try to add something to the basket i get the following error :

    Parameter name: Could not find price in standard product tree, and no valid master product set on Product node so cannot search in Master product tree. Product node was 1168  at CogworksPriceBreaksForTeaCommerce.Helpers.GetMasterProductNode(Int32 orderLineNodeId, String currencyISOCode)  at CogworksPriceBreaksForTeaCommerce.BusinessLogic.ApplyPriceBreaksToOrder(Order order)  at CogworksPriceBreaksForTeaCommerce.TeaCommerceEvents.WebshopEvents_OrderLineAdded(Order order, OrderLine orderLine)  at TeaCommerce.Data.Extensibility.TCEventHandler`2.Invoke(T1 arg1, T2 arg2)  at TeaCommerce.Data.Extensibility.WebshopEvents.SendOrderLineAdded(Order order, OrderLine orderLine)

    As we spoke about i dont use the TC master product setup and ive left the master product property to "masterProduct" in the config as it says " Leave as "masterProduct" if not in use".

  • Tom Smith 98 posts 172 karma points
    Oct 18, 2012 @ 11:46
    Tom Smith
    0

    Hi Rasmus,

    The ProductPriceBreaksUmbracoPropertyPrefix / ProductPriceUmbracoPropertyPrefix config items should just be the prefix, I.e. without the 3 letter country ISO code. 

    Price breaks supports multiple currencies so this cannot be hard coded. 

    Try it using productPriceBreaks and productPrice (I.e remove DKK)

    Many thanks

    Tom

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

    Arh you are right i forgot how it worked :) 

    And it works almost ! 

    when I add 2 uniqueorderline of the same product where it has a pricebreak at 2 products and up. It works ! :)

    The place where it dosnt work is when i remove 1 of the 2 products again, then it keeps the pricebreak price on the single item. 

    now i have added 1 product and the price is correct. (its just a demo product :) )

    Now i add another and the pricebreak price is activated :D

    Now when i remove one of the products it keeps its pricebreak value :

  • Tom Smith 98 posts 172 karma points
    Oct 18, 2012 @ 12:26
    Tom Smith
    0

    Ah! Crumbs! 

    OK - let me look into that one,

    Nearly there :)

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

    Yea :D 

  • Tom Smith 98 posts 172 karma points
    Oct 19, 2012 @ 19:50
    Tom Smith
    0

    Hi Rasmus,

    OK, Price Breaks V2.0 Beta 2 is now ready for test!

    https://www.dropbox.com/sh/7rlg2outs91c17t/9OwXeyMgc3/CogworksPriceBreaksForTeaCommerce_2.0_Beta.zip

    This should fix the issue you were experiencing above - let me know as I can't test directly?

    You can also now exculude individual nodes from the price breaks logic - this could help with your discount issue. On the discount node (or product doctype generally) add a checkbox with property alias "excludeFromPriceBreaks" (this property alias is configurable in the config if you want to call it something else)

    More generally - If this is box ticked - the product (and all children of the product) will be excluded from price breaks. If it's a master product then all children of the master product and all related products in the prodcut tree will be excluded from the logic.

    Let me know how it goes?

    Many Thanks,

    Tom

  • Rasmus Fjord 675 posts 1566 karma points c-trib
    Oct 22, 2012 @ 09:34
    Rasmus Fjord
    0

    Hey Tom :) 

    Ill take it for a spin hopefully today or tomorrow to give it a test :) 

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

    Ey Tom :) 

    Ive just tested it quick and so far its working like a boss ! 

    Havnt had time to test the ExcludeNodeTypes and ExcludeFromPriceBreaksPropertyAlias config settings yet. 

  • Rasmus Fjord 675 posts 1566 karma points c-trib
    Nov 02, 2012 @ 13:12
    Rasmus Fjord
    0

    Hey Tom 

    Ive just done a few more tests and it seem to just work. it seems awesome! 

    I havnt had a setup to test ExcludeNodeTypes and ExcludeFromPriceBreaksPropertyAlias yet, since quite swarmed, and i did a workaround in my setup.

    So if you can test those it would be great. But im thinking about putting it in production unless you have more to add?

  • Tom Smith 98 posts 172 karma points
    Nov 05, 2012 @ 11:40
    Tom Smith
    1

    Hi Rasmus,

    Hope you're well,

    I tested the exclude items at my end and they all seem to work OK. Variants are OK as well. The only thing I havent been able to completely test are master products, but if you're not using these then I'd say you're good to use it in production.

    I will also release it as version 2 this week,

    Many Thanks,

    Tom

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

    That is just awesome ! :D

    Thx for a superb response and solution ! 

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

    Hey Tom 

    Ive had the time to test your extra config field. ExcludeFromPriceBreaksPropertyAlias

    Just so we are clear, on how this is used :

    I create a new property(true/false), on my product documenttype, on my "special" product named "savings" i have crossed it off, so now pricebreak shouldnt touch this one right ?

    Ive created the property and crossed it off on my hidden product "saving" : 

     

     

    But when i have a product in my basket :

    I now add a "saving"(im creating a new function for coupon codes)

    And at last i up the quantity of the saving and it then resets my saving

     

     

    Ive put in the exclude on my "reduktion af pris" product which is a special savings product im using.

    Can you help :)

     

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

    hmm it might work anyway.

  • Tom Smith 98 posts 172 karma points
    Nov 29, 2012 @ 17:10
    Tom Smith
    0

    Hi Rasmus,

    Hope you're well?

    As long as the <ExcludeFromPriceBreaksPropertyAlias> is set to excludeFromPB it should work. 

    The config settings are cached so you may need to hit the web config on the site after updating?

    Let me know if it's still doing something wierd. 

    Many Thanks,

    Tom

Please Sign in or register to post replies

Write your reply to:

Draft