Copied to clipboard

Flag this post as spam?

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


  • aaeda 117 posts 150 karma points
    Apr 21, 2020 @ 12:53
    aaeda
    0

    Hello

    I have installed Tea commerce on an existing site. Have installed the package but not the starter kit as the website already exists.

    I have followed the installation steps (creation of store, country, currency etc..) and also inspired from the starter kit to build up the cart.

    However I am having an empty cart after 'Add to basket'.

    I am unsure of the page : /base/TC/FormPost.aspx Where can it be found?

    Can anyone help please?

    thanks

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Apr 21, 2020 @ 12:59
    Matt Brailsford
    0

    Hi aaeda

    Can you share the code you are using to add a product to the cart? And also the code you are using to display the number of items in the cart? Also, can you check your log file to see if you are experiencing any errors.

    Many thanks

    Matt

  • aaeda 117 posts 150 karma points
    Apr 21, 2020 @ 13:02
    aaeda
    0

    Hello Matt

    Yes sure. Please see below.

    <form method="post" action="/base/TC/FormPost.aspx" class="ajaxForm" data-product-id="@productPage.Id">
        <input name="AddOrUpdateOrderLine" value="productIdentifier, quantity" type="hidden" />
    
        <input name="storeId" value="@storeId" type="hidden" />
         <input name="productIdentifier" value="@productPage.Id" type="hidden" />
                                                        <div class="form-group">
                                                          <label class="col-sm-3 control-label">Quantity</label>
                                                          <div class="col-sm-9">
                                                            <input class="form-control" name="quantity" value="1" type="text" />
                                                          </div>
                                                        </div>
                                                        <input class="btn btn-primary btn-block" value="Add to basket" type="submit" />
                                                        </form>
    

    Cannot see any error as such in the logs. Note that we are on the trial version to test everything before buying the license.

    thanks for your help.

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Apr 21, 2020 @ 13:06
    Matt Brailsford
    0

    Ok, that seems ok to me, and using the demo version should work fine locally so don't think that's the issue.

    The /base/TC/FormPost.aspx URL is just something that exists so you shouldn't need to worry about this.

    Just to check, you are using Umbraco v7 right? And can you share the code that you are using to render the cart?

    Many thanks

    Matt

  • aaeda 117 posts 150 karma points
    Apr 21, 2020 @ 13:11
    aaeda
    0

    Hello Matt

    Yes using umbraco version 7. For the cart, I have created the same as what's there on the demo site. please see below.

    @using TeaCommerce.Api.Models
    

    @using TeaCommerce.Umbraco.Web @inherits Umbraco.Web.Mvc.UmbracoTemplatePage @{ Layout = "CartStepMaster.cshtml"; IPublishedContent currentPage = Model.Content; IPublishedContent nextStep = currentPage.Children.FirstOrDefault();

    //store id long storeId = long.Parse( currentPage.GetPropertyValue

    Order order = TC.GetCurrentOrder( storeId, false ); @order; } @section Cartcontent { @if ( order != null ) {

    aaaa

    Your cart

    Product
    Unit price
    Quantity
    Total
    @foreach ( OrderLine orderLine in order.OrderLines ) { IPublishedContent productContent = Umbraco.TypedContent( orderLine.ProductIdentifier );
    Product: @orderLine.Name
    @if ( orderLine.UnitPrice.Discount.Value > 0M ) { @orderLine.UnitPrice.WithoutDiscounts } @orderLine.UnitPrice.Value Unit price:
    Quantity:
    @if ( orderLine.TotalPrice.Discount.Value > 0M ) { @orderLine.TotalPrice.WithPreviousDiscounts } @orderLine.TotalPrice.Value Total price:
    }
    Subtotal
    @if ( order.SubtotalPrice.Discount.Value > 0M ) { @order.SubtotalPrice.WithPreviousDiscounts } @order.SubtotalPrice.Value
    @if ( order.ShipmentInformation.ShippingMethodId != null ) { ShippingMethod shippingMethod = TC.GetShippingMethod( storeId, order.ShipmentInformation.ShippingMethodId.Value );
    Shipping (@shippingMethod.Name)
    @if ( order.ShipmentInformation.TotalPrice.WithoutDiscounts.Value != order.ShipmentInformation.TotalPrice.Value.Value ) { @order.ShipmentInformation.TotalPrice.WithoutDiscounts } @order.ShipmentInformation.TotalPrice.Value
    } @if ( order.PaymentInformation.PaymentMethodId != null ) { PaymentMethod paymentMethod = TC.GetPaymentMethod( storeId, order.PaymentInformation.PaymentMethodId.Value );
    Payment (@paymentMethod.Name)
    @if ( order.PaymentInformation.TotalPrice.WithoutDiscounts.Value != order.PaymentInformation.TotalPrice.Value.Value ) { @order.PaymentInformation.TotalPrice.WithoutDiscounts } @order.PaymentInformation.TotalPrice.Value
    } @if ( order.TotalPrice.GiftCardsAmount.Value > 0M ) {
    @(order.GiftCards.Count > 1 ? "Gift cards" : "Gift card")
    }
    Total incl. VAT
    @if ( order.TotalPrice.WithPreviousDiscounts.Value != order.TotalPrice.Value.Value ) { @order.TotalPrice.WithPreviousDiscounts } @order.TotalPrice
    VAT
    @order.TotalPrice.Value.VatFormatted
    @if ( order.DiscountCodes.Any() ) {

    Your discount codes: @string.Join( ", ", order.DiscountCodes.Select( d => "\"" + d.Code + "\"" ) )

    }

    Have a discount code?

    }

    }

    thanks

  • aaeda 117 posts 150 karma points
    Apr 21, 2020 @ 13:16
  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Apr 21, 2020 @ 13:35
    Matt Brailsford
    0

    Hi aaeda,

    Ok, well, looking at the site you've linked to, clicking add to cart does appear to be adding products to the order as the response from this in dev tools is showing a valid cart so I think your issue is to do with your cart rendering.

    From what I can tell, navigating to your cart page, you don't appear to be rendering the cart at all. You are displaying the section headers, but I don't see any markup related to the cart markup you have referenced above anywhere in your cart page. My guess would be that this code isn't actually being used so I'd double check your templates are setup correctly and are linked to your cart page or if this code is inside a partial, make sure the partial is being rendered in your cart page template.

    Hope this helps

    Matt

Please Sign in or register to post replies

Write your reply to:

Draft