Copied to clipboard

Flag this post as spam?

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


  • David Sheiles 67 posts 337 karma points
    Dec 21, 2016 @ 23:39
    David Sheiles
    0

    Customising line item price calculations

    Hi,

    I'm hoping that someone can point me in the right direction with customising the calculation of each line item.

    I have the following modifications that happen to each line item:

    1. A discount based on quantity and
    2. A setup cost for each item added to the basket (The setup varies based on the product).

    I'm using Fasttrack as the basis of the site and I have had some success with storing info in the ItemExtendedData and overriding the AddBasketItem in the method to do my calculations etc.

    I update the variant price based on the discount and setup cost. This seems to work fine until checkout where the line item price seem to be reset to the defaults.

    I then get around this by overriding the OnCreate function in the FastTrackCheckoutSummaryModelFactory, however I cant seem to adjust the grand total which is still the default price.

    I feel that I'm not approaching it in the right way and I possibly need to have my own basket model (or something like that) that does the calculation.

    Any ideas on how to approach this would be fantastic, as I've become a bit stuck.

  • David Sheiles 67 posts 337 karma points
    Dec 22, 2016 @ 05:42
    David Sheiles
    101

    OK, to answer my own question:

    I found the following comment in the merchello config:

    The following task is intended to assert that pricing and/or on sale value has not changed in the back office since the customer has placed an item into their basket or wish list. If you have made custom pricing modifications in your implementation, you may either remove this task or adjust your code to add a new extended data value merchLineItemAllowsValidation = false to the line item so that it is skipped in the validation process.

    This is why the pricing changed each time it was sent to the checkout process. I simply uncommented out the ValidateProductPriceTask from the config and it's all working.

    Thanks for putting the comment in there Rusty!

  • Dan 15 posts 86 karma points
    Jul 10, 2018 @ 16:44
    Dan
    0

    Hi David,

    Just wondering how you set up the set up cost fee for each item as I need to do something similar. I need to add an installation fee for each basket. For example, a customer can add as many or as little items to the basket as they want but no matter the figure, they will always need to pay this one of fee.

    Does this make sense?

    Thanks, Dan

Please Sign in or register to post replies

Write your reply to:

Draft