Copied to clipboard

Flag this post as spam?

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


  • simon eriksen 24 posts 113 karma points
    Aug 05, 2016 @ 09:18
    simon eriksen
    0

    adding extra prices to basket

    Hello. First time using Tea Commerce. I am trying to add different extra prices to a product depending on what a customer choses in fx size, color etc. the prices come from going through different pages picking something on each page, eventually ending up on an overview page where each product has its own form, but i cant seem to acces the forms on the basketpage with Request.Form. the product itself with its starting price is in the basket.

    ex. var colorprice = Convert.ToInt32(Request.Form["colorprice"]);

    becomes an empty variable.

  • Rune Grønkjær 1372 posts 3103 karma points
    Aug 05, 2016 @ 09:54
    Rune Grønkjær
    0

    Hi Simon,

    One way is to use the variants system in Tea Commerce. Each variant can be comprised of both size, color and whatever you need. In Umbraco you can add a price to each variant. In your frontend you will let the user choose the size, color etc. and the in the end you add the corresponding variant to the cart. Check out the variant system here: https://demo.teacommerce.net/ https://demo.teacommerce.net/umbraco/

    If you need each color and size to have it's own price, that needs to be added to the total unitprice of the product/order line you can do this: - Add the price to the color and size document types (Again see the demo to find the variant groups). - After that you just need to build a custom order line calculator to calculate the price from the prices on the product and the variant groups: https://documentation.teacommerce.net/net-api/price-calculators/order-line-calculator/

    Hope this helps /Rune

  • simon eriksen 24 posts 113 karma points
    Aug 16, 2016 @ 09:04
    simon eriksen
    0

    Hi Rune

    I've got the total variantprice, but i get an error trying to add it up with the unitprice

    Operator '+' cannot be applied to operands of type 'TeaCommerce.Api.Models.Price' and 'int

    Converting the unitprice to int also makes an error.

  • Rune Grønkjær 1372 posts 3103 karma points
    Aug 16, 2016 @ 09:08
    Rune Grønkjær
    0

    What did you end up trying to do? You're not giving me a lot to work with :)

  • simon eriksen 24 posts 113 karma points
    Aug 16, 2016 @ 09:14
    simon eriksen
    0

    I've got the unitprice from the nodeid. bprice is the extras prices that needs to be added to the unitprice and placed in the basket. bprice is the full price of all the extras prices. But when attempting to do so, we get beforementioned error. code here:

    @(orderLine.UnitPrice + Convert.ToInt32(bprice))

  • Rune Grønkjær 1372 posts 3103 karma points
    Aug 16, 2016 @ 09:58
    Rune Grønkjær
    0

    The Price object cannot be calculated as it's not a number. The price object have several version of the price with and without VAT. You should use Visual Studios code completion to find the value on the Price you need for the job you are trying to accomplish.

Please Sign in or register to post replies

Write your reply to:

Draft