Copied to clipboard

Flag this post as spam?

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


  • ianhoughton 281 posts 605 karma points c-trib
    Jan 18, 2012 @ 21:40
    ianhoughton
    0

    Problem with payment and shipping methods

    I'm trying to implement teacommerce into my existing site, and have got everything working apart from the shipping & payment method names appearing at step 3 of the checkout.

    I've checked the dictionary items against the values in the teacommerce section for each payment method. They appear to match but I get no text. The images associated with each method appear ok, as do the prices and radio buttons.

    Its obviously something I've changed but cannot find out what :)

  • Anders Burla 2560 posts 8256 karma points
    Jan 19, 2012 @ 00:16
    Anders Burla
    0

    Hi Ian

    Could you try and write out the dictionary item name - do you get a value there? If yes - you should just use that to get the text from umbraco.library:GetDictionaryItem

    Kind regards
    Anders

  • ianhoughton 281 posts 605 karma points c-trib
    Jan 26, 2012 @ 01:00
    ianhoughton
    0

    Hi Anders,

    Sorry for the late reply, I'm working on this charity site in my spare time. I'm still having problems getting the payment methods to show. I'm using the starter kit XSLT (cart_step03.xslt)

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [
      <!ENTITY nbsp "&#x00A0;">
    ]>
    <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:msxml="urn:schemas-microsoft-com:xslt"
      xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:teacommerce="urn:teacommerce"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets teacommerce ">

      <!--
    Tea Commerce Cart step 3
    -->

      
      <xsl:output method="html" omit-xml-declaration="yes"/>
    <!--
        WHAT IS THIS FILE?
        The shipping and payment step of the cart.
    -->

      <xsl:include href="cart_stepProgress.xslt"/>
      <xsl:param name="currentPage"/>

      <xsl:template match="/">

        <xsl:apply-templates select="$currentPage" />

      </xsl:template>

      <xsl:template match="CartStep">
        <!-- VARIABLES START -->

        <!-- The Order -->
        <xsl:variable name="order" select="teacommerce:GetOrderXml()" />
        <!-- All shipping methods -->
        <xsl:variable name="shippingMethods" select="teacommerce:GetShippingMethods()" />
        <!-- All payment methods -->
        <xsl:variable name="paymentMethods" select="teacommerce:GetPaymentMethods()" />
        <!-- All countries -->
        <xsl:variable name="countries" select="teacommerce:GetCountries()" />
        <!-- The current country -->
        <xsl:variable name="currentCountry" select="teacommerce:GetCurrentCountry()" />
        <!-- The next step is found dynamically -->
        <xsl:variable name="nextStep" select="following-sibling::CartStep[1]" />
        <!-- The previous step is found dynamically -->
        <xsl:variable name="prevStep" select="preceding-sibling::CartStep[1]" />
        <!-- The total quantity -->
        <xsl:variable name="totalQuantity">
          <xsl:choose>
            <xsl:when test="$order/@id != ''">
              <xsl:value-of select="$order/@totalQuantity" />
            </xsl:when>
            <xsl:otherwise>
              <xsl:text>0</xsl:text>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:variable>
        
        <xsl:variable name="stepId" select="@id" />
        <!-- The current steps position in the cart step process is calculated -->
        <xsl:variable name="cartStepPosition">
          <xsl:for-each select="ancestor-or-self::Homepage//CartStep">
            <xsl:if test="@id = $stepId">
              <xsl:value-of select="position()" />
            </xsl:if>
          </xsl:for-each>
        </xsl:variable>
        <!-- The steps class is dynamically created -->
        <xsl:variable name="cartClass">
          <xsl:value-of select="concat('stepProgress', $cartStepPosition)" />
          <xsl:value-of select="concat(' items', $totalQuantity)" />
        </xsl:variable>

        <!-- VARIABLES END -->

        <!-- HTML START -->
        <div id="cart">
          <xsl:attribute name="class">
            <xsl:value-of select="$cartClass" />
          </xsl:attribute>
          <!-- The following div#invokeXSLT is used by the update script to load the correct xslt when updating the UI -->
          <div class="invokeXSLT">cart_step03.xslt</div>

          <xsl:apply-templates mode="CartStepProgress" select="$currentPage" />

          <form action="/tcbase/teacommerce/SubmitForm.aspx" method="post">
            <xsl:if test="$nextStep != ''">
              <input name="ReturnUrl" type="hidden" value="{umbraco.library:NiceUrl($nextStep/@id)}" />
            </xsl:if>
            <input name="SetPaymentMethod" type="hidden" value="paymentMethod" />
            <input name="SetShippingMethod" type="hidden" value="shippingMethod" />
            
            <!-- Payment START -->
            <div id="paymentInformation">
              <h2>Choose Payment Method</h2>
              <xsl:value-of select="$shippingMethods"/>
              <table cellpadding="0" cellspacing="0" border="0">
                <xsl:for-each select="$paymentMethods/payment">
                  <xsl:variable name="imageUrl">
                    <xsl:if test="@mediaId != ''">
                      <xsl:value-of select="umbraco.library:GetMedia(@mediaId, 0)/umbracoFile" />
                    </xsl:if>
                  </xsl:variable>
                  <xsl:variable name="name" select="umbraco.library:GetDictionaryItem(@dictionaryItemName)" />
                  <xsl:variable name="desc" select="umbraco.library:GetDictionaryItem(concat(@dictionaryItemName, 'Desc'))" />
                  <tr>
                    <td class="col1">
                      <xsl:if test="@mediaId != ''">
                        <label for="{concat('payment', @id)}">
                          <img src="{$imageUrl}" alt="{$name}" />
                        </label>
                      </xsl:if>
                    </td>
                    <td class="col2">
                      <label for="{concat('payment', @id)}">
                        <xsl:value-of select="$name" />
                        <span>
                          <xsl:value-of select="$desc" />
                        </span>
                      </label>
                    </td>
                    <td class="col3">
                      <label for="{concat('payment', @id)}"><xsl:value-of select="@feeFormatted" /></label>
                    </td>
                    <td class="col4">
                      <div>
                        <input id="{concat('payment', @id)}" value="{@id}" name="paymentMethod" type="radio">
                          <xsl:if test="$order/payment/@id = @id">
                            <xsl:attribute name="checked" />
                          </xsl:if>
                        </input>
                      </div>
                    </td>
                  </tr>
                </xsl:for-each>
              </table>
              
            </div>
            <!-- Payment END -->
          
            <!-- Shipping START -->
            <div id="shippingInformation">
              <h2>Choose Shipping Method</h2>
              <table cellpadding="0" cellspacing="0" border="0">
                <xsl:for-each select="$shippingMethods/shipping">
                  <xsl:variable name="imageUrl">
                    <xsl:if test="@mediaId != ''">
                      <xsl:value-of select="umbraco.library:GetMedia(@mediaId, 0)/umbracoFile" />
                    </xsl:if>
                  </xsl:variable>
                  <xsl:variable name="name" select="umbraco.library:GetDictionaryItem(@dictionaryItemName)" />
                  <xsl:variable name="desc" select="umbraco.library:GetDictionaryItem(concat(@dictionaryItemName, 'Desc'))" />
                  <tr>
                    <td class="col1">
                      <xsl:if test="@mediaId != ''">
                        <label for="{concat('shipping', @id)}">
                          <img src="{$imageUrl}" alt="{$name}" />
                        </label>
                      </xsl:if>
                    </td>
                    <td class="col2">
                      <label for="{concat('shipping', @id)}">
                        <xsl:value-of select="$name" />
                        <span>
                          <xsl:value-of select="$desc" />
                        </span>
                      </label>
                    </td>
                    <td class="col3">
                      <label for="{concat('shipping', @id)}"><xsl:value-of select="@feeFormatted" /></label>
                    </td>
                    <td class="col4">
                      <div>
                        <input id="{concat('shipping', @id)}" value="{@id}" name="shippingMethod" type="radio">
                          <xsl:if test="$order/shipping/@id = @id">
                            <xsl:attribute name="checked" />
                          </xsl:if>
                        </input>
                      </div>
                    </td>
                  </tr>
                </xsl:for-each>
              </table>
            </div>
            <!-- Shipping END -->

            <div id="cartBottom" class="noPrint">
              <xsl:if test="$prevStep != ''">
                <href="{umbraco.library:NiceUrl($prevStep/@id)}" id="prev">
                  <xsl:value-of select="$prevStep/headerText" disable-output-escaping="yes" />
                </a>
              </xsl:if>
              <xsl:if test="$nextStep != ''">
                <div id="nextWrap">
                  <div>
                    <xsl:value-of select="$nextStep/headerText" disable-output-escaping="yes" />
                  </div>
                  <input type="submit" value="{$nextStep/headerText}" id="next" link="{umbraco.library:NiceUrl($nextStep/@id)}" />
                </div>
              </xsl:if>
            </div>
          </form>
        </div>
        <!-- HTML END -->
      </xsl:template>

    </xsl:stylesheet>

    This is the part that doesn't show anything:

    <td class="col2">
                      <label for="{concat('shipping', @id)}">
                        <xsl:value-of select="$name" />
                        <span>
                          <xsl:value-of select="$desc" />
                        </span>
                      </label>
                    </td>
  • ianhoughton 281 posts 605 karma points c-trib
    Jan 26, 2012 @ 01:18
    ianhoughton
    0

    when viewing the page with Umbraco Debug on I get a number of these errors:

    Error returning dictionary item 'creditCard'
    Object reference not set to an instance of an object.
      at umbraco.library.GetDictionaryItem(String Key)

    There are entries in the dictionary for Credit Card called creditCard & creditCardDesc, the payment section in TeaCommerce uses the same Dictionary Item. The only other thing I can think of is that I'm not using a langauge node, but everything else on the site is working correctly.

  • Anders Burla 2560 posts 8256 karma points
    Jan 26, 2012 @ 16:46
    Anders Burla
    0

    Can you use a normal umbraco dictionary item in your template. If yes - try in your xslt for some hardcoded value. If you can do that - then you would have to do some xslt copy to see what value you send as the dictionary key.

    Kind regards
    Anders

  • ianhoughton 281 posts 605 karma points c-trib
    Jan 26, 2012 @ 18:21
    ianhoughton
    0

    Cracked it !!

    I had set the language but not assigned a domain / language on the root node. Once I put this in, the payment & shipping dictionary items appeared correctly.

    Thanks for the pointers Anders, cheers Ian

  • Anders Burla 2560 posts 8256 karma points
    Jan 26, 2012 @ 18:39
    Anders Burla
    0

    Super - glad you found the solution.

    Could you mark the right answer as the solution as a help to others - thanks :)

    Kind regards
    Anders

Please Sign in or register to post replies

Write your reply to:

Draft