Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 4 of 4

Thread: Skin Token - Cart Total Dollar Amount

  1. #1
    hunter0781 is offline Member
    Join Date
    Apr 2010
    Posts
    34

    Thumbs up Skin Token - Cart Total Dollar Amount

    Is there a token to display the cart total (no luck here searching the code)?

    If not, has anyone wrote the code for this and willing to share?

    Cheers!

    Andy

  2. #2
    valentim is offline Senior Member
    Join Date
    Apr 2006
    Posts
    192

    Default

    Create a new XMLPackage and copy the contents of minicart.xml.config into it. Strip out anything you don't need and include your new package in your page/template.

    e.g.

    Code:
    <xsl:template match="/">
    <xsl:value-of select="aspdnsf:CartSubTotal()" disable-output-escaping="yes" />
    </xsl:template>
    Matthew
    Aydus Consulting
    Strategy+Development+Design=The Aydus Difference

  3. #3
    hunter0781 is offline Member
    Join Date
    Apr 2010
    Posts
    34

    Default

    Thanks Matthew! I did just what you said and gutted the minicart xml package.

    Code:
    <?xml version="1.0" standalone="yes" ?>
    <package version="2.1" displayname="Display Cart Subtotal" debug="false" includeentityhelper="false">
    
      <!-- ###################################################################################################### -->
      <!-- Copyright AspDotNetStorefront.com, 1995-2010.  All Rights Reserved.					                -->
      <!-- http://www.aspdotnetstorefront.com														                -->
      <!-- For details on this license please visit  the product homepage at the URL above.		                -->
      <!-- THE ABOVE NOTICE MUST REMAIN INTACT.                                                                   -->
      <!--                                                                                                        -->
      <!-- ###################################################################################################### -->
    
    
      <PackageTransform>
        <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                        xmlns:aspdnsf="urn:aspdnsf" exclude-result-prefixes="aspdnsf">
          <xsl:output method="html" omit-xml-declaration="yes" />
          <xsl:template match="/">
            <xsl:value-of select="aspdnsf:CartSubTotalSCD()" disable-output-escaping="yes" />
          </xsl:template>
        </xsl:stylesheet>
      </PackageTransform>
      
    </package>

    I also copied the CartSubTotal call in the xsltextensionbase.cs and renamed it something different incase I wanted to use the mini cart in the future.

    Everything seems to work great at first then unexpectedly the xml package throws an error causing additional errors and my site craps out and I have to touch the web.config to restart it.

    Below is the initial error:

    Code:
    XmlPackageException	Error has occured on xml package: showcartsubtotal.xml.config
     	
    Details
    Page URL:/c-10-tiny-temptations.aspx
    Source:AspDotNetStorefrontCore
    Message:Object reference not set to an instance of an object.
    Stack Trace:
    at AspDotNetStorefrontCore.DB.Scalar`1.ExecuteScalar(SqlCommand cmd) in C:\9013\ASPDNSFCore\DB.cs:line 810
    at AspDotNetStorefrontCore.AppLogic.GetStateID(String StateAbbreviation) in C:\9013\ASPDNSFCore\AppLogic.cs:line 7098
    at AspDotNetStorefrontCore.Shipping.ShippingMethodIsValid(Int32 ShippingMethodID, String StateAbbrev, String CountryName) in C:\9013\ASPDNSFCore\Shipping.cs:line 115
    at AspDotNetStorefrontCore.ShoppingCart.AnalyzeCartForFreeShippingConditions(Int32 AddressID) in C:\9013\ASPDNSFCore\ShoppingCart.cs:line 8078
    at AspDotNetStorefrontCore.ShoppingCart..ctor(SqlTransaction DBTrans, Int32 SkinID, Customer ThisCustomer, CartTypeEnum CartType, Int32 OriginalRecurringOrderNumber, Boolean OnlyLoadRecurringItemsThatAreDue, Boolean IsAjaxMiniCart) in C:\9013\ASPDNSFCore\ShoppingCart.cs:line 688
    at AspDotNetStorefrontCore.ShoppingCart..ctor(SqlTransaction DBTrans, Int32 SkinID, Customer ThisCustomer, CartTypeEnum CartType, Int32 OriginalRecurringOrderNumber, Boolean OnlyLoadRecurringItemsThatAreDue) in C:\9013\ASPDNSFCore\ShoppingCart.cs:line 593
    at AspDotNetStorefrontCore.ShoppingCart..ctor(Int32 SkinID, Customer ThisCustomer, CartTypeEnum CartType, Int32 OriginalRecurringOrderNumber, Boolean OnlyLoadRecurringItemsThatAreDue) in C:\9013\ASPDNSFCore\ShoppingCart.cs:line 589
    at AspDotNetStorefrontCore.XSLTExtensionBase.CartSubTotalSCD() in C:\9013\ASPDNSFCore\XSLTExtensionBase.cs:line 4054
    Is anyone else experiencing issues/random errors in the system log when using the ajax minicart?

    Thanks!

  4. #4
    valentim is offline Senior Member
    Join Date
    Apr 2006
    Posts
    192

    Default

    Andy - we're in production with no issues as you've described. We have a slightly different setup in case this helps.

    We created a new package file (based on a copy of MiniCart.xml.config). e.g. CustomMiniCart.xml.config

    We call that XMLPackage from our template as follows:

    Code:
    <asp:Literal ID="litMiniCart" Text="<%$ Tokens:XMLPackage, CustomMiniCart.xml.config %>" runat="server" />
    So you can use your custom package to display the cart total without touching any minicart code.
    Matthew
    Aydus Consulting
    Strategy+Development+Design=The Aydus Difference