Subscription email confirm help

We have an issue w/ our subscription email confirmation that we were hoping someone could assist with.  Basically, the confirmation is not displaying all of the seats for orders where the number of pkg line items for a given package is greater than one.   For example, pkg 123 is added to an order, then added again.  Only one of the instances of the package has seats being displayed.    

Below is a copy of the portion of the offending code (sorry about the formatting).  Any assistance would be appreciated!

Note that we do group the pkg together in the same section regardless of the number of line items (which is fine).

 

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="2.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns="http://www.w3.org/1999/xhtml">
  <xsl:output method="html" indent="yes" encoding="utf-8" omit-xml-declaration="yes" />

    <xsl:key name="lineit" match="LineItem" use="li_seq_no"/>
    <xsl:key name="pkglino" match="LineItem" use="pkg_li_no"/>
    <xsl:key name="subli" match="SubLineItem" use="li_seq_no"/>
  <xsl:key name="pkgno" match="LineItem" use="pkg_no"/>

  <xsl:template match="/">

      <!-- SUBS HANDLING -->
      <xsl:if test="count(//GetOrderDetailsInfoResults/LineItem[pkg_no!=0]) &gt; 0">

          <xsl:variable name="thisTotal" select="sum(//GetOrderDetailsInfoResults/SubLineItem[pkg_no!=0]/due_amt)" />
          <tr>
              <td align="left" valign="top" colspan="2" style="background-color: #666666; color: #FFFFFF;">
                  <b>Subscription(s):</b>
              </td>
          </tr>
          <tr>
              <td align="left" valign="top" colspan="2">
                  <table align="left" valign="top" cellpadding="2" cellspacing="0" width="100%">
                      <tr>
                          <th align="left" valign="top" style="font-size: 11px; font-weight: bold; text-decoration: underline;" width="300">Description</th>
                          <th align="left" valign="top" style="font-size: 11px; font-weight: bold; text-decoration: underline;" width="250">Location</th>
                          <th align="left" valign="top" style="font-size: 11px; font-weight: bold; text-decoration: underline;" width="108">Seat(s)</th>
                      </tr>
                      <xsl:for-each select="//GetOrderDetailsInfoResults/LineItem[not(pkg_no=preceding-sibling::LineItem/pkg_no) and pkg_no != 0]">

                          <xsl:variable name="pkgNo" select="pkg_no" />
                          <xsl:variable name="subs_facility" select="facility" />
                          <xsl:variable name="parLiNo" select="pkg_li_no" />
                          <xsl:variable name="LiSeqno" select="li_seq_no" />
                          <xsl:variable name="bg">
                              <xsl:choose>
                                  <xsl:when test="position() mod 2 =  1">
                                      <xsl:text>#FFFFFF</xsl:text>
                                  </xsl:when>
                                  <xsl:otherwise>
                                      <xsl:text>#EFEFEF</xsl:text>
                                  </xsl:otherwise>
                              </xsl:choose>
                          </xsl:variable>
              
                          <tr bgcolor="{$bg}">
                              <td align="left" valign="top" colspan="1">
                                  <b>
                                      <xsl:value-of select="pkg_desc" />:
                    <xsl:value-of select="$subs_facility"></xsl:value-of>
                                  </b>
                              </td>
                              <td></td>
                              <td>
                                  
                              </td>

                              <td>
                                  <xsl:value-of select="format-number(sum(key('subli', key('lineit', key('pkgno', pkg_no)/li_seq_no)/li_seq_no)/due_amt), '$###,###.00')"/>
                              </td>
                            </tr>
                          <!-- display primary selection first -->
                          <xsl:for-each select="//GetOrderDetailsInfoResults/LineItem[pkg_li_no = $parLiNo and pkg_no = $pkgNo and perf_desc != 'Broadway Branding Fee' and perf_desc != 'Broadway Branding Fee' and perf_desc != 'Broadway Patron Fee' and perf_desc != 'Broadway Handling Fees' and perf_desc != 'OPA Handling Fee']">
                              <xsl:variable name="liNo" select="li_seq_no" />
                              <xsl:variable name="dt">
                                  <xsl:call-template name="FormatDate">
                                      <xsl:with-param name="DateTime" select="perf_dt"/>
                                  </xsl:call-template>
                              </xsl:variable>
                              <xsl:variable name="liSeatsTotal" select="sum(//GetOrderDetailsInfoResults/SubLineItem[li_seq_no=$liNo]/due_amt)" />
                              <tr bgcolor="{$bg}">
                                  <td align="left" valign="top" width="300">
                                      <xsl:choose><xsl:when test="contains(perf_desc,'Weaver Lounge')">Weaver Lounge - <xsl:value-of select="text3"/></xsl:when><xsl:otherwise><xsl:value-of select="perf_desc"/></xsl:otherwise></xsl:choose>
                                      <br/>
                                      <xsl:value-of select="facility_desc" />
                                      <br/>
                                      <xsl:value-of select="$dt" />
                                  </td>
                                  <td align="left" valign="top" width="256">
                                      <xsl:value-of select="//GetOrderDetailsInfoResults/SubLineItem[li_seq_no=$liNo]/zone_desc"/>
                                  </td>
                                  <td align="left" valign="top" width="108">
                                      <xsl:for-each select="//GetOrderDetailsInfoResults/SubLineItem[li_seq_no=$liNo]">
                                          <xsl:if test="string(seat_num) != '' and section_desc='General Admission' and not(contains(zone_desc,'Valet Parking'))">
                                              <xsl:value-of select="section_short_desc"/>
                                              <BR/>
                                          </xsl:if>
                                              <xsl:if test="string(seat_num) != '' and section_desc != 'General Admission'">
                                              <xsl:value-of select="seat_row"/>
                                              <xsl:value-of select="seat_num"/>
                                              <BR/>
                                          </xsl:if>
                                          <xsl:if test="contains(zone_desc,'Valet Parking')">
                                          </xsl:if>
                                          <xsl:if test="string(seat_num) = ''">
                                              TBD<BR/>
                                          </xsl:if>
                                      </xsl:for-each>
                                  </td>
                              </tr>
                          </xsl:for-each>

                      </xsl:for-each>
                      <tr>
                          <td align="right" valign="top" colspan="4" style="border-top: 1px solid #666666;">Total Subscription Cost:</td>
                          <td align="right" valign="top" style="border-top: 1px solid #666666;">
                              <xsl:value-of select="format-number($thisTotal, '$###,###.00')" />
                          </td>
                      </tr>
                  </table>
              </td>
          </tr>
      </xsl:if>
      <!-- /SUBS HANDLING -->

Parents
  • I was able to sort this out.  xslt is so much fun!  In case anyone runs into a similar issue in the future, here is what I did. 

    In order for our template to handle orders that could contain both super and standard packages (as well as one added multiple times), I had to change the first for each statement to:

    <xsl:for-each select="//GetOrderDetailsInfoResults/LineItem[not(pkg_no=preceding-sibling::LineItem/pkg_no and pkg_li_no=preceding-sibling::LineItem/pkg_li_no) and pkg_no != 0]">

    I also added a super_pkg variable w/in this loop:

     <xsl:variable name="superPkgNo" select="super_pkg_no" />

    ...last, check if the superPkgNo value is null or not and display the corresponding total:

    <xsl:choose>
       <xsl:when test="($superPkgNo)">
          <xsl:value-of select="format-number(sum(key('subli', key('lineit', key('pkgno', pkg_no)/li_seq_no)/li_seq_no)/due_amt), '$###,###.00')"/>
       </xsl:when>
       <xsl:when test="not($superPkgNo)">
           <xsl:value-of select="format-number(sum(key('subli', key('lineit', key('pkglino', pkg_li_no)/li_seq_no)/li_seq_no)/due_amt), '$###,###.00')"/>
       </xsl:when>
    </xsl:choose>

Reply
  • I was able to sort this out.  xslt is so much fun!  In case anyone runs into a similar issue in the future, here is what I did. 

    In order for our template to handle orders that could contain both super and standard packages (as well as one added multiple times), I had to change the first for each statement to:

    <xsl:for-each select="//GetOrderDetailsInfoResults/LineItem[not(pkg_no=preceding-sibling::LineItem/pkg_no and pkg_li_no=preceding-sibling::LineItem/pkg_li_no) and pkg_no != 0]">

    I also added a super_pkg variable w/in this loop:

     <xsl:variable name="superPkgNo" select="super_pkg_no" />

    ...last, check if the superPkgNo value is null or not and display the corresponding total:

    <xsl:choose>
       <xsl:when test="($superPkgNo)">
          <xsl:value-of select="format-number(sum(key('subli', key('lineit', key('pkgno', pkg_no)/li_seq_no)/li_seq_no)/due_amt), '$###,###.00')"/>
       </xsl:when>
       <xsl:when test="not($superPkgNo)">
           <xsl:value-of select="format-number(sum(key('subli', key('lineit', key('pkglino', pkg_li_no)/li_seq_no)/li_seq_no)/due_amt), '$###,###.00')"/>
       </xsl:when>
    </xsl:choose>

Children
No Data