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.

  • Nauman 98 posts 118 karma points
    Aug 17, 2010 @ 11:59
    Nauman
    0

    Empty Cart

    I have installed ucommerce and customising it within umbraco. I know I can remove an item from cart, if I ste its qty to 0 and update it.

    Is there a way that by calling a simple macro or function I empty the cart no matter how many products are in there?

    Nauman

  • Nauman 98 posts 118 karma points
    Aug 17, 2010 @ 12:36
    Nauman
    0

    I found the solution

     

    <xsl:template name="emptyBasketTemplate">
        <xsl:if test="CommerceLibrary:HasBasket()">
          <xsl:for-each select="CommerceLibrary:GetBasket()/purchaseOrder/lineItems/lineItem">
            <!-- Find the name of the posted quantity change -->
            <xsl:variable name="postedQuantity" select="umbraco.library:RequestForm(concat('quantityInput_', @index))"/>
            <xsl:variable name="result" select="CommerceLibrary:UpdateLineItem(@index, 0)"></xsl:variable>
          </xsl:for-each>
        </xsl:if>   
      </xsl:template>

     

    I have amended following line

    <xsl:variable name="result" select="CommerceLibrary:UpdateLineItem(@index, 0)"></xsl:variable>

    now i call this template thorugh a macro to empty the cart

     

  • Søren Spelling Lund 1797 posts 2786 karma points
    Aug 17, 2010 @ 13:55
    Søren Spelling Lund
    0

    CommerceLibrary:ClearBasket() should do the trick as well.

  • Nauman 98 posts 118 karma points
    Aug 18, 2010 @ 05:26
    Nauman
    0

    Thanks Soren for the help.

    Cheers

    Nauman

  • Tony Lorentzen 85 posts 174 karma points
    Jul 27, 2011 @ 00:03
    Tony Lorentzen
    0

    Why does uCommerce:HasBasket() return 'true' even if there are no items in the basket?

  • Søren Spelling Lund 1797 posts 2786 karma points
    Jul 28, 2011 @ 17:07
    Søren Spelling Lund
    0

    Hi Tony,

    You might have an empty basket assigned to you. A new basket will be assigned to the customer if a call is made to CommerceLibrary:GetBasket() as it will create a new basket if one is not present. If you want to control when baskets are created you can use GetBasket(false), which tells uCommerce not to assign a new basket if one isn't assigned to the customer.

    Hope this helps.

Please Sign in or register to post replies

Write your reply to:

Draft