Copied to clipboard

Flag this post as spam?

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


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • Fabio Milheiro 74 posts 136 karma points
    Nov 13, 2012 @ 17:12
    Fabio Milheiro
    0

    How to create a donation product which price is chosen by customer?

    In the uCommerce template store there's a Software product definition with a license data type.

    How do I create a donation amount data type and can I influence the product price automatically?

    Also, how is it possible to add the donation amount to "Add to basket" button using XSLT?

  • Søren Spelling Lund 1797 posts 2786 karma points
    Nov 19, 2012 @ 11:13
    Søren Spelling Lund
    0

    Hi Fabio,

    Catalog Foundation Explained: Product Definitions explains how to set up definitions and data types. The Catalog Structure overview video explains some of the same concepts, but in video form obviously :)

    You can absolutely influence the product price on the order line and you don't have to set up a definition to do so, although it would make sense if you want to lock in the values the customer can select.

    It's not possible to override the price on an order line from XSLT so you'll have to do a bit of .NET to get there. Here's an example of how to do it:

    // Get basket
    var basket = TransactionLibrary.GetBasket().PurchaseOrder; 
    var orderLine = basket.OrderLines.SingleOrDefault(x => x.Sku == "MySKu" && x.VariantSku == "MyVariantSku");

    // Set the price of the order line
    orderLine.Price = 100m;

    basket.Save();

    // Execute basket pipeline to tally the new totals
    TransactionLibrary.ExecuteBasketPipeline();

    Hope this helps.

  • Fabio Milheiro 74 posts 136 karma points
    Nov 19, 2012 @ 18:54
    Fabio Milheiro
    0

    Already implemented using product variants but that is very useful to know. Many of our clients are charities and they'll want to add donation amounts. Having a text input instead of a dropdown might be ideal for some clients.

    Never occurred to me that just changing the price of the order line would do anything... Thanks for the help Soren, again!

  • Søren Spelling Lund 1797 posts 2786 karma points
    Nov 23, 2012 @ 14:53
    Søren Spelling Lund
    0

    No problem.

  • Lukman 9 posts 29 karma points
    May 26, 2014 @ 14:51
    Lukman
    0

    Could you explain how a recurring donation to be executed or developed?

Please Sign in or register to post replies

Write your reply to:

Draft