Announcement

Collapse
No announcement yet.

Javascript Error Checkout 0

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Javascript Error Checkout 0

    Hi,

    When trying to resolve an issue and before approaching the forum I have in advertantly changed part of checkout page 0 so I now get the error:

    'A javascript error has been found on the page ('g arrCountries' is undefined)

    This is something to do with the invoice country field and I have reverted the various libraries back to default.


    Below is the select statement from the country


    <select id="lstInvoiceCountry" name="LocationInvoiceCountry" tabindex="NETQUOTEVAR:TABINDEXINVOICECOUNTRY" onchange="InvoiceCountryChanged();">
    <option value=""><actinic:variable name="SelectCountry" />

    Below is the invoice phase:

    NETQUOTEDEL:INVOICEPHASE

    <!-- XML tags for formatting of the address list in B2B mode -->
    <Actinic:VAR NAME=ADDRESS_COLUMNS VALUE=3/> <Actinic:VAR NAME=ADDRESS_FORM0 VALUE="
    <INPUT TYPE=HIDDEN NAME=%sADDRESSSELECT VALUE=%s>
    <B>%s</B><BR>%s,<BR>%s,<BR>%s,<BR>%s, <B>%s</B>,<BR><B>%s</B>
    "/> <Actinic:VAR NAME=ADDRESS_FORM1 VALUE="
    <U><B>%s:</B></U>
    <INPUT TYPE=RADIO NAME=%sADDRESSSELECT VALUE=%s%s><BR>
    <B>%s</B><BR>%s,<BR>%s,<BR>%s,<BR>%s, <B>%s</B>,<BR><B>%s</B>
    "/> <Actinic:VAR NAME=ADDRESS_FORM2 VALUE="
    <U><B>%s:</B></U>
    <INPUT TYPE=RADIO NAME=%sADDRESSSELECT VALUE=%s%s><BR>
    <B>%s</B><BR>%s,<BR>%s,<BR>%s,<BR>%s, <B>%s</B>,<BR><B>%s</B>
    "/> <Actinic:VAR NAME=ADDRESS_TITLE0 VALUE=""/> <Actinic:VAR NAME=ADDRESS_TITLE1 VALUE="%s:"/>
    <Actinic:VAR NAME=ADDRESS_TITLE2 VALUE="%s:"/> <Actinic:VAR NAME=ADDRESS_TITLE10 VALUE=""/>
    <Actinic:VAR NAME=ADDRESS_TITLE11 VALUE=""/> <Actinic:VAR NAME=ADDRESS_TITLE12 VALUE="
    <INPUT TYPE=RADIO id=idADDRESSSELECT_0 NAME=%sADDRESSSELECT VALUE=0 CHECKED>
    %s:
    "/> <Actinic:VAR NAME=ADDRESS_TABLE VALUE="
    %s
    <TABLE WIDTH=<actinic:variable name="ACTSTDWIDTH" /> BORDER=0 CELLSPACING=0 CELLPADDING=1 BGCOLOR=%s><TR><TD>
    <TABLE WIDTH=100%% BORDER=0 CELLSPACING=0 CELLPADDING=4 BGCOLOR=%s>
    %s
    </TABLE>
    </TD></TR></TABLE>
    %s
    "/>
    <!-- End of B2B address formatting tags -->
    <Actinic:BOTHADDRESSDETAILS>

    <input type="hidden" name="ActCheckoutPhase" value="INVOICE">
    <input type="hidden" name="ActCheckoutPhase" value="DELIVER">
    <input type="hidden" name="ActCheckoutPhase" value="PRELIM">

    <!-- idBothAddressesTable is used by javascript -->
    <!-- class InvoiceField is used by javascript -->
    <!-- class DeliverField is used by javascript -->
    <table id="idBothAddressesTable" class="checkout">
    <colgroup>
    <col class="prompt" >
    <col>
    <actinic:block if="%3cactinic%3avariable%20name%3d%22InvoicePrompt016Visible%22%20%2f%3e">
    <col>
    </actinic:block>
    </colgroup>
    <tr class="ShowAlways">
    <th>&nbsp;</th>
    <th class="InvoiceField" id="idInvoiceHeader"><actinic:variable name="InvoiceTitle" /></th>
    <actinic:block if="%3cactinic%3avariable%20name%3d%22InvoicePrompt016Visible%22%20%2f%3e">
    <th class="DeliverField" id="idDeliverHeader"><actinic:variable name="DeliverTitle" /></th>
    </actinic:block>
    <actinic:block if="%21%3cactinic%3avariable%20name%3d%22InvoicePrompt016Visible%22%20%2f%3e" >
    <Actinic:ONLYINB2B>
    <th class="DeliverField" id="idDeliverHeader"><actinic:variable name="DeliverTitle" /></th>
    </Actinic:ONLYINB2B>
    </actinic:block>
    </tr>
    <actinic:block if="%3cactinic%3avariable%20name%3d%22IsNotPreviewMode%22%20%2f%3e">
    <Actinic:ACCOUNT TYPE="ROW">
    <tr class="ShowAlways">
    <td>&nbsp;</td>
    <td class="InvoiceField" id="idInvoiceAccountAddresses"><Actinic:ACCOUNTINVOICE />
    </td>
    <td class="DeliverField" id="idDeliverAccountAddresses"><Actinic:ACCOUNTDELIVER />
    </td>
    </tr>
    </Actinic:ACCOUNT>
    </actinic:block>
    <Actinic:ADDRESSES TYPE=INVOICEFORM>
    <tr id="idSeparateShipRow" <actinic:block if="%3cactinic%3avariable%20name%3d%22InvoicePrompt016Visible%22%20%2f%3e%20%3d%3d%200" >style="display: none;"</actinic:block>>
    <td >&nbsp;</td>
    <td colspan="2" id="idSeparateShipCell" class="InvoiceField" style="padding-left: 0;">
    <input type="checkbox" <Actinic:Variable Name="InvoiceSeparateCheckStatus"/> id="idSEPARATESHIP" name="SEPARATESHIP" value="YES" onclick="SetDeliveryAddressVisibility();" tabindex="NETQUOTEVAR:TABINDEXINVOICESEPARATESHIP" style="border: 0;">
    <label for="idSEPARATESHIP"><actinic:variable name="InvoicePrompt016" /></label>
    </td>
    </tr>
    <actinic:variable value="Both Addresses Salutation" name="CheckoutPrompt" if="%3cactinic%3avariable%20name%3d%22InvoicePrompt000Visible%22%20%2f%3e" />
    <actinic:variable name="CheckoutPrompt" value="Both Addresses Name" />
    <actinic:variable value="Both Addresses Job Title" name="CheckoutPrompt" if="%3cactinic%3avariable%20name%3d%22InvoicePrompt002Visible%22%20%2f%3e" />
    <actinic:variable value="Both Addresses Company Name" name="CheckoutPrompt" if="%3cactinic%3avariable%20name%3d%22InvoicePrompt003Visible%22%20%2f%3e" />
    <actinic:block if="%28%3cactinic%3avariable%20name%3d%22ALPInvoiceLookupEnabled%22%20%2f%3e%20%3d%3d%20true%29" >
    <actinic:variable name="CheckoutPrompt" value="Both Addresses Postal Code" if="%3cactinic%3avariable%20name%3d%22InvoicePrompt008Visible%22%20%2f%3e"/>
    </actinic:block>
    <actinic:variable name="CheckoutPrompt" value="Both Addresses Line 1" if="%3cactinic%3avariable%20name%3d%22InvoicePrompt004Visible%22%20%2f%3e" />
    <actinic:variable name="CheckoutPrompt" value="Both Addresses Line 2" if="%3cactinic%3avariable%20name%3d%22InvoicePrompt005Visible%22%20%2f%3e" />
    <actinic:variable name="CheckoutPrompt" value="Both Addresses Line 3" if="%3cactinic%3avariable%20name%3d%22InvoicePrompt006Visible%22%20%2f%3e" />
    <actinic:variable name="CheckoutPrompt" value="Both Addresses Country" if="%3cactinic%3avariable%20name%3d%22InvoicePrompt009Visible%22%20%2f%3e"/>
    <actinic:variable name="CheckoutPrompt" value="Both Addresses Line 4" if="%3cactinic%3avariable%20name%3d%22InvoicePrompt007Visible%22%20%2f%3e"/>
    <actinic:block if="%28%3cactinic%3avariable%20name%3d%22ALPInvoiceLookupEnabled%22%20%2f%3e%20%3d%3d%20false%29" >
    <actinic:variable name="CheckoutPrompt" value="Both Addresses Postal Code" if="%3cactinic%3avariable%20name%3d%22InvoicePrompt008Visible%22%20%2f%3e"/>
    </actinic:block>
    <actinic:variable value="Both Addresses Residential" name="CheckoutPrompt" if="%3cactinic%3avariable%20name%3d%22InfoRequiredForInvoiceResidential%22%20%2f%3e%20%7c%7c%20%3cactinic%3avariable%20name%3d%22InfoRequiredForDeliveryResidential%22%20%2f%3e" />
    <actinic:variable name="CheckoutPrompt" value="Both Addresses Phone" if="%3cactinic%3avariable%20name%3d%22InvoicePrompt010Visible%22%20%2f%3e"/>
    <actinic:variable name="CheckoutPrompt" value="Both Addresses Mobile" if="%3cactinic%3avariable%20name%3d%22InvoiceMobileVisible%22%20%2f%3e" />
    <actinic:variable name="CheckoutPrompt" value="Both Addresses Fax" if="%3cactinic%3avariable%20name%3d%22InvoicePrompt011Visible%22%20%2f%3e"/>
    <actinic:variable value="Both Addresses Email" name="CheckoutPrompt" if="%3cactinic%3avariable%20name%3d%22InvoicePrompt012Visible%22%20%2f%3e%20%7c%7c%20%3cactinic%3avariable%20name%3d%22DeliveryPrompt023Visible%22%20%2f%3e" />
    <actinic:variable value="Both Addresses User Defined" name="CheckoutPrompt" if="%3cactinic%3avariable%20name%3d%22InvoicePrompt014Visible%22%20%2f%3e" />
    <actinic:variable name="CheckoutPrompt" value="Moving In One Month" if="%3cactinic%3avariable%20name%3d%22InvoicePrompt013Visible%22%20%2f%3e"/>
    <actinic:variable name="CheckoutPrompt" value="Keep Details Private" if="%3cactinic%3avariable%20name%3d%22InvoicePrompt015Visible%22%20%2f%3e"/>
    </table>
    <table class="checkout">
    <actinic:variable name="CheckoutPrompt" value="Remember Me" if="%3cactinic%3avariable%20name%3d%22InvoicePrompt017Visible%22%20%2f%3e"/>
    </Actinic:ADDRESSES>
    </table>
    </Actinic:BOTHADDRESSDETAILS>
    <actinic:block if="%3cactinic%3avariable%20name%3d%22InvoicePrompt016Visible%22%20%2f%3e">
    <script language="javascript" type="text/javascript" >
    SetDeliveryAddressVisibility();
    </script>
    </actinic:block>
    NETQUOTEDEL:INVOICEPHASE


    Any help would be appreciated.

    Thanks
    Attached Files

    #2
    I have noticed if I add the layout 'Invoice Country List' into the section Both Addresses Address Field section of code the error goes away.

    I do not think it is suppossed to be there but I am not sure where it goes.

    This has left the final problem of having two country fields one for the drop down and a single field when you select none of the above. It is not switching between visible and invisible - does any one have a pointers on this problem?

    Thanks

    Comment


      #3
      Better late than never......

      Anthony this is probably of no use to yourself any longer but i ran into the same problem and can offer the solution.

      g_arrCountries is defined within the:

      <actinic:variable name="JavaScriptFunctions" />

      tag which should reside in the head of your pages. Within this layout should be:

      <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Checkout%20Page%200%22%20%7c%7c%20%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Add%20To%20Cart%20Confirmation%22" >
      <actinic:variable name="Javascript Country State Maps" selectable="false" />
      </actinic:block>

      Effectively its the block that creates the invoice countries when needed. This is I believe a v10 change in line with the new checkout design. As such i found it was missing as i had copied across a v9 template and it wasn't in it....

      Regards,

      Guy

      Lead Developer - Lock Shop Warehouse
      Stocking a huge range of padlocks alongside a vast assortment of security products, including a selection of the best door locks around.
      Regards,

      Guy

      Lead Developer - Lock Shop Warehouse
      Offering discounted padlocks, and a huge range from the best door lock suppliers, all alongside other essential security products.

      Comment


        #4
        HELP !

        I have the same problem in V11 after upgrading from V9

        Javascript error in cart part 2 = g_arrCountries is not defined

        Can you explain with more details, because I don't found the variable "JavaScriptFunction" and i'm not really expert...

        Sorry for my poor English Language, I'm a French user...
        Attached Files
        "LABOR IMPROBUS OMNIA VINCIT"

        Comment


          #5
          Late again I'm affraid, incase anyone else has trouble with this I'll explain it again below:

          the error:

          g_arrCountries is not defined

          Can be caused by upgrading to v10 or v11 and this javascript variable not being included in your design files.

          To correct the problem find your Javascript Functions, probably located in the <head> of your page template and open it up. If you do not see a layout called 'Javascript Country State Maps' within a block if statement, copy and paste the following:

          Code:
          <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Checkout%20Page%200%22%20%7c%7c%20%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Add%20To%20Cart%20Confirmation%22" >
              <actinic:variable name="Javascript Country State Maps" selectable="false" />	
          </actinic:block>
          You can place the above code anywhere within the Javascript Functions layout.

          Once you've included it if you apply the changes and go to your Checkout Page 0 layout you will be able to open the 'Javascript Country State Maps' layout in which you should see a variable:

          Code:
          <actinic:variable name="JavascriptCountryMap" selectable="false" />
          within a set of script tags, thats the variable that writes out the g_arrCountries array and should get everything up and running again.
          Regards,

          Guy

          Lead Developer - Lock Shop Warehouse
          Offering discounted padlocks, and a huge range from the best door lock suppliers, all alongside other essential security products.

          Comment


            #6
            Thanks,

            This worked for me. I first realised there was a problem when there were no countries in my invoice country dropdown box.

            I pasted the suggested block of code into my header region after the last closing script tag:

            Code:
            <SCRIPT LANGUAGE =JavaScript>
            <!--
            function BulletList(pItem)
            {
            var strIDs = '<ul>';
              {
              for (var i = 1; i <= pItem.length; i++)
                {
                strIDs += '<li><a href=' + pItem[i].sURL + '>'+ pItem[i].sName + '</a></li>';
                }
              }
            strIDs += '</UL>'
            return strIDs
            }
            -->
            </SCRIPT>
            <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Checkout%20Page%200%22%20%7c%7c%20%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Add%20To%20Cart%20Confirmation%22" >
                <actinic:variable name="Javascript Country State Maps" selectable="false" />	
            </actinic:block>
            </head>
            Lance

            www.brightkidz.co.uk

            "High visibility clothing and accessories for children and adults"

            Comment

            Working...
            X