Copied to clipboard

Flag this post as spam?

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


  • phil 58 posts 78 karma points
    Apr 03, 2012 @ 13:27
    phil
    0

    Can't get passed personal-information

    I have my personal information page to allow the user to enter in the name and address etc and using validation like in the starter kit so make sure certain fields are entered the valadation works fine if i have a field blank it alerts me to fill in it but if all the required fields are filled in it relads the personal information page instead of loading the shipping info page

    I did some debugging into this and worked out the code isn't getting passed the l;ine of code sending the form data to the updateOrderProperties function

    TeaCommerce.updateOrderProperties(formObjasyncfalse });
    

    I tried wrapping this line of code in a try catch and get the error

    "Type Error: Cannot call method split of underfined"

    I can't work out what is underfined and why I have teh following code

    I can output each field value correctly in alert boxes and get to alert test1 but not alert test2

     can you see what I have done wrong

    function sendCustomerInformation({
      var paymentInformation jQuery("#paymentInformation"),
          shippingInformation jQuery("#shippingInformation");
      /*
      We fetch the information from the form and creates
      an object that can be sent to the server as a form
      POST submit
      */
      var formObj {
        companypaymentInformation.find("#company").val(),
        titlepaymentInformation.find("#title").val(),
        firstNamepaymentInformation.find("#firstName").val(),
        lastNamepaymentInformation.find("#lastName").val(),
        streetAddresspaymentInformation.find("#streetAddress").val(),
        citypaymentInformation.find("#city").val(),
        countypaymentInformation.find("#county").val(),
        postCodepaymentInformation.find("#postCode").val(),
        emailpaymentInformation.find("#email").val(),
        phonepaymentInformation.find("#phone").val(),
        mobilepaymentInformation.find("#mobile").val(),
        commentsjQuery("#comments").val(),
        shipping_companyshippingInformation.find("#shippingCompany").val(),
        shipping_titleshippingInformation.find("#shippingTitle").val(),
        shipping_firstNameshippingInformation.find("#shippingFirstName").val(),
        shipping_lastNameshippingInformation.find("#shippingLastName").val(),
        shipping_streetAddressshippingInformation.find("#shippingStreetAddress").val(),
        shipping_cityshippingInformation.find("#shippingCity").val(),
        shipping_countyshippingInformation.find("#shippingCounty").val(),
        shipping_postCodeshippingInformation.find("#shippingPostCode").val()
        
      };

      //Simple validation
      var pageValidateText '';
      if (formObj.title === ''{
        pageValidateText += '\n' paymentInformation.find("#title").prev().text();
      }
      if (formObj.lastName === ''{
        pageValidateText += '\n' paymentInformation.find("#lastName").prev().text();
      }
      if (formObj.streetAddress === ''{
        pageValidateText += '\n' paymentInformation.find("#streetAddress").prev().text();
      }
      if (formObj.postCode === ''{
        pageValidateText += '\n' paymentInformation.find("#postCode").prev().text();
      }
      if (formObj.email === ''{
        pageValidateText += '\n' paymentInformation.find("#email").prev().text();
      }
      if (formObj.phone === ''{
        pageValidateText += '\n' paymentInformation.find("#phone").prev().text();
      }
      
      
      if (pageValidateText != ''{
        
        //The form does not validate and we pop up the result
        pageValidateText 'Remember to fill out' pageValidateText;
        alert(pageValidateText);
        return false//Return false and the browser will not send the user to the next step
      }
       
      /*
      The properties is sent to the server with a syncronous call
      This way we lock the UI and can redirect the user.
      */
      try {
      alert("test1");
      TeaCommerce.updateOrderProperties(formObjasyncfalse });
      }
      catch(e{
        alert(e);
      }
        
      alert("test2");
      return true//Return true and the browser will send the user to the next step
    }


  • Anders Burla 2560 posts 8256 karma points
    Apr 03, 2012 @ 15:31
    Anders Burla
    0

    Hi Phil

    Try and do something like this and also have it in a try catch and see if you still get an error.

    TeaCommerce.updateOrderLineProperty( nodeId, 'yourAlias', 'test' );

    Kind regards
    Anders

  • phil 58 posts 78 karma points
    Apr 03, 2012 @ 15:48
    phil
    0

    Its not the updateOrderLineProperty method i'm trying to all its the updateOrderProperties to save the payment and shipping address

  • Anders Burla 2560 posts 8256 karma points
    Apr 03, 2012 @ 15:56
    Anders Burla
    0

    I know - my idea was to test a basic scenario to know where to look for the error.

    Kind regards
    Anders

  • phil 58 posts 78 karma points
    Apr 03, 2012 @ 16:00
    phil
    0

    Ah ok sorry that worked all went through without any errors and loaded the shiiping info page

  • phil 58 posts 78 karma points
    Apr 03, 2012 @ 16:03
    phil
    0

    Also when I click on submit shipping and payment info to load the accept order it stays on the shipping info page again the validation works if a payment or shipping method hasn't been selected

  • Anders Burla 2560 posts 8256 karma points
    Apr 03, 2012 @ 16:06
    Anders Burla
    0

    Which values do you have here in your generel settings?

     

  • phil 58 posts 78 karma points
    Apr 03, 2012 @ 16:12
    phil
    0

    Order name prefix - ORDER-

    First name property alias - firstName

    last name property alias - lastName

    E-mail property alias - email

    use cookies ticked

    Cookie timeout - 24

    Prices in DB incl. VAT - ticked

    VAT group property alias - blank

    Master product property alias - blank

    Order line property aliases - productTitle, productCode

    Confirmation E-mail [email protected] 

  • Rune Grønkjær 1372 posts 3103 karma points
    Apr 04, 2012 @ 10:05
    Rune Grønkjær
    0

    Hi Phil,

    Still having problems with this? If you do you will have to start debugging your javascript. Do the following:

    1. Try and remove properties from the formObj until it starts working again.
    2. After that you can hopefully see which properties where giving you the problems and then start looking at why. If it's not obvious you must check it/them with firebug to see what their values are.

    /Rune 

  • phil 58 posts 78 karma points
    Apr 04, 2012 @ 12:26
    phil
    0

    Hi Rune 

    I am still having problems I have tried removing all properties but done of them fix the problem when debugging the code all the values in firebug are correct as the values i entered into the form 

    Phil

  • Anders Burla 2560 posts 8256 karma points
    Apr 04, 2012 @ 13:46
    Anders Burla
    0

    Rune could it be that its trying to post the form instead of doing a normal javascript base call? In the Tea Commerce code there is a split call in the method that tries to parse the form when doing the smart form post base methods.

    Kind regards
    Anders

  • phil 58 posts 78 karma points
    Apr 04, 2012 @ 13:51
    phil
    0

    On the form page i submit the page with 

    <input type="submit" value="Shipping Payment" id="next" link="/Basket/Shipping-Information" class="personalInfoSubmit">
    

    This calls the teaCommerce_Advanced.js when calls the sendCustomerInformation method in teaCommerce-Simple.js
     

    jQuery('.personalInfoSubmit').live("click"function ({
      var validate sendCustomerInformation();
      if (validate{
        window.location.href jQuery(this).attr('link');
      }
      return false;
    });

    If this is the case how to I send it the right way cheers phil

  • phil 58 posts 78 karma points
    Apr 04, 2012 @ 14:31
    phil
    0

    I have changed the code to as below but still getting the same error have i missed something

    <input type="submit" value="Shipping Payment" id="personalInfoSubmit" link="/Basket/Shipping-Information">
    
    jQuery('#personalInfoSubmit').live("click"function ({
      var validate sendCustomerInformation();
      if (validate{
        window.location.href jQuery(this).attr('link');
      }
      return false;
    });
  • phil 58 posts 78 karma points
    Apr 04, 2012 @ 15:11
    phil
    0

    I have just tried testing the cart process from basket to accept order form with the following calls in try catch code each 1 errors with TypeError: Cannot call method split of undefined. When I get to the accept order form the customer information in the personal information, shipping price and payment price is displayed dispite the error but the shipping information in the personal information isn't

    TeaCommerce.updateOrderProperties(formObjasyncfalse });
    
    TeaCommerce.setShippingMethod(shippingMethodasyncfalse }); 
    TeaCommerce.setPaymentMethod(paymentMethodasyncfalse }); 


  • phil 58 posts 78 karma points
    Apr 05, 2012 @ 11:38
    phil
    0

    When I firebug the personal information page I get the response below as far as I can see all looks fine. All the data i entered for all the textboxes on the form and listed with all the order information can you double check nothing else is need or anything cheers

    in Chrome I get the error TypeError method split of underfined

    in Firefox I get the error Type Error Cart.attr("class") is undefined

    {"OrderPropertiesUpdated":[{"Id":0,"Alias":"company","Value":"company value"},{"Id":0,"Alias":"title","Value":"title value"},{"Id":0,"Alias":"firstName","Value":"first name value"},{"Id":0,"Alias":"lastName","Value":"last name value"},{"Id":0,"Alias":"streetAddress","Value":"street address value "},{"Id":0,"Alias":"city","Value":"city value"},{"Id":0,"Alias":"county","Value":"county value"},{"Id":0,"Alias":"postCode","Value":"postcode value"},{"Id":0,"Alias":"email","Value":"email value"},{"Id":0,"Alias":"phone","Value":"phone value"},{"Id":0,"Alias":"mobile","Value":"mobile value"},{"Id":0,"Alias":"comments","Value":"comment value"},{"Id":0,"Alias":"shipping_company","Value":"shipping company value"},{"Id":0,"Alias":"shipping_title","Value":"shipping title value"},{"Id":0,"Alias":"shipping_firstName","Value":"shipping first name value"},{"Id":0,"Alias":"shipping_lastName","Value":"shipping last name value"},{"Id":0,"Alias":"shipping_streetAddress","Value":"shipping street address value"},{"Id":0,"Alias":"shipping_city","Value":"shipping city value"},{"Id":0,"Alias":"shipping_county","Value":"shipping county value"},{"Id":0,"Alias":"shipping_postCode","Value":"shipping postcode value"}],"Order":{"Id":305,"Country":{"Id":1,"Name":"United Kingdom"},"CreatedDate":"\/Date(1333617715190+0100)\/","Currency":{"CultureName":"en-GB","ISOCode":"GBP","Id":4},"IsOrder":false,"MemberId":null,"ModifiedDate":"\/Date(1333618378750+0100)\/","Name":"ORDER-305","OrderDate":"\/Date(1333616958487+0100)\/","OrderLines":[{"Id":656,"IsUnique":true,"NodeId":1244,"Properties":[{"Id":2963,"Alias":"nodeName","Value":"Adnet Mirror"},{"Id":2964,"Alias":"productMaterial","Value":"1"},{"Id":2965,"Alias":"productColour","Value":"1717"},{"Id":2966,"Alias":"productFinish","Value":"1"},{"Id":2967,"Alias":"productSize","Value":"1826"},{"Id":2968,"Alias":"priceCalculated","Value":"true"}],"Quantity":1,"TotalPrice":539.00004000,"TotalPriceFormatted":"£539.00","TotalPriceFormattedNoSymbol":"539.00","TotalPriceWithoutVAT":449.1667,"TotalPriceWithoutVATFormatted":"£449.17","TotalPriceWithoutVATFormattedNoSymbol":"449.17","TotalVAT":89.83334000,"TotalVATFormatted":"£89.83","TotalVATFormattedNoSymbol":"89.83","UnitPrice":539.00004000,"UnitPriceFormatted":"£539.00","UnitPriceFormattedNoSymbol":"539.00","UnitPriceWithoutVAT":449.1667,"UnitPriceWithoutVATFormatted":"£449.17","UnitPriceWithoutVATFormattedNoSymbol":"449.17","UnitVAT":89.83334000,"UnitVATFormatted":"£89.83","UnitVATFormattedNoSymbol":"89.83","VAT":0.2000,"VATPercent":"20"}],"OrderStatus":{"DictionaryItemName":"","Id":1,"Name":"New"},"Payment":{"DictionaryItemName":"","Fee":0.0000,"FeeFormatted":"£0.00","FeeFormattedNoSymbol":"0.00","FeeVAT":0.0000,"FeeVATFormatted":"£0.00","FeeVATFormattedNoSymbol":"0.00","FeeWithoutVAT":0,"FeeWithoutVATFormatted":"£0.00","FeeWithoutVATFormattedNoSymbol":"0.00","Id":4,"MediaId":null,"Name":"PayPal"},"PaymentStatus":null,"Properties":[{"Id":810,"Alias":"company","Value":"company value"},{"Id":811,"Alias":"title","Value":"title value"},{"Id":812,"Alias":"firstName","Value":"first name value"},{"Id":813,"Alias":"lastName","Value":"last name value"},{"Id":814,"Alias":"streetAddress","Value":"street address value "},{"Id":815,"Alias":"city","Value":"city value"},{"Id":816,"Alias":"county","Value":"county value"},{"Id":817,"Alias":"postCode","Value":"postcode value"},{"Id":818,"Alias":"email","Value":"email value"},{"Id":819,"Alias":"phone","Value":"phone value"},{"Id":820,"Alias":"mobile","Value":"mobile value"},{"Id":821,"Alias":"comments","Value":"comment value"},{"Id":822,"Alias":"shipping_company","Value":"shipping company value"},{"Id":823,"Alias":"shipping_title","Value":"shipping title value"},{"Id":824,"Alias":"shipping_firstName","Value":"shipping first name value"},{"Id":825,"Alias":"shipping_lastName","Value":"shipping last name value"},{"Id":826,"Alias":"shipping_streetAddress","Value":"shipping street address value"},{"Id":827,"Alias":"shipping_city","Value":"shipping city value"},{"Id":828,"Alias":"shipping_county","Value":"shipping county value"},{"Id":829,"Alias":"shipping_postCode","Value":"shipping postcode value"}],"Shipping":{"DictionaryItemName":"","Fee":49.999999999999999999999999998,"FeeFormatted":"£50.00","FeeFormattedNoSymbol":"50.00","FeeVAT":8.333333333333333333333333333,"FeeVATFormatted":"£8.33","FeeVATFormattedNoSymbol":"8.33","FeeWithoutVAT":41.666666666666666666666666665,"FeeWithoutVATFormatted":"£41.67","FeeWithoutVATFormattedNoSymbol":"41.67","Id":2,"MediaId":null,"Name":"Courier"},"TotalPrice":589.00004000000000000000000000,"TotalPriceFormatted":"£589.00","TotalPriceFormattedNoSymbol":"589.00","TotalPriceWithoutFees":539.00004000,"TotalPriceWithoutFeesFormatted":"£539.00","TotalPriceWithoutFeesFormattedNoSymbol":"539.00","TotalPriceWithoutFeesWithoutVAT":449.1667,"TotalPriceWithoutFeesWithoutVATFormatted":"£449.17","TotalPriceWithoutFeesWithoutVATFormattedNoSymbol":"449.17","TotalPriceWithoutVAT":490.83336666666666666666666666,"TotalPriceWithoutVATFormatted":"£490.83","TotalPriceWithoutVATFormattedNoSymbol":"490.83","TotalQuantity":1,"TotalVAT":98.16667333333333333333333333,"TotalVATFormatted":"£98.17","TotalVATFormattedNoSymbol":"98.17","TotalVATWithoutFees":89.83334000,"TotalVATWithoutFeesFormatted":"£89.83","TotalVATWithoutFeesFormattedNoSymbol":"89.83","Transaction":{"PaymentAmount":null,"PaymentAmountFormatted":"£0.00","PaymentAmountFormattedNoSymbol":"0.00","PaymentCardNumber":null,"PaymentCardType":null,"PaymentTransactionId":null},"UmbracoLanguageId":0,"VAT":0.2000,"VATGroupId":2,"VATPercent":"20"}}

     

  • Rune Grønkjær 1372 posts 3103 karma points
    Apr 10, 2012 @ 10:34
    Rune Grønkjær
    0

    Hi Phil,

    Sounds like "cart" may be undefined and the only place it can happen in the standard code is in the updateCartUI method. Thats if you use an unchanged teaCommerce_Simple.js file. Only problem is that that should'nt happen with jQuery behind the wheel. Have you changed anything to the javascripts?

    /Rune

  • phil 58 posts 78 karma points
    Apr 10, 2012 @ 11:00
    phil
    0

    The only bits I have changed in the teaCOmmerce-Simple.js file is in the updateCartUI I have changed the update cart content to match by basket and the sendCustomerInformation to include the fields I want to include on the page. The code I now have for each is both below is anything wrong with any of it

    function updateCartUI(order{
      //Update the cart content
      jQuery('#subTotal').text(order.TotalPriceWithoutFeesWithoutVATFormatted);
      jQuery('#vat').text(order.TotalVATFormatted);
      jQuery('#cartTotalQuantity').text(order.TotalQuantity);
      jQuery('#cartTotalPrice').text(order.TotalPriceFormatted);
      
      var cart jQuery('#cart'),
          cartClasses cart.attr('class').split(' '),
          cartStepClass '';
      for(0cartClasses.lengthi++){
        if(cartClasses[i].indexOf('stepProgress'-1){
          cartStepClass cartClasses[i];
          break;
        }
      }
      cart.attr('class'cartStepClass ' ' 'items' order.TotalQuantity);
    }
    function sendCustomerInformation({
      var paymentInformation jQuery("#paymentInformation"),
          shippingInformation jQuery("#shippingInformation");
      /*
      We fetch the information from the form and creates
      an object that can be sent to the server as a form
      POST submit
      */
      
      var formObj {
        companypaymentInformation.find("#company").val(),
        titlepaymentInformation.find("#title").val(),
        firstNamepaymentInformation.find("#firstName").val(),
        lastNamepaymentInformation.find("#lastName").val(),
        streetAddresspaymentInformation.find("#streetAddress").val(),
        citypaymentInformation.find("#city").val(),
        countypaymentInformation.find("#county").val(),
        postCodepaymentInformation.find("#postCode").val(),
        emailpaymentInformation.find("#email").val(),
        phonepaymentInformation.find("#phone").val(),
        mobilepaymentInformation.find("#mobile").val(),
        commentsjQuery("#comments").val(),
        shipping_companyshippingInformation.find("#shippingCompany").val(),
        shipping_titleshippingInformation.find("#shippingTitle").val(),
        shipping_firstNameshippingInformation.find("#shippingFirstName").val(),
        shipping_lastNameshippingInformation.find("#shippingLastName").val(),
        shipping_streetAddressshippingInformation.find("#shippingStreetAddress").val(),
        shipping_cityshippingInformation.find("#shippingCity").val(),
        shipping_countyshippingInformation.find("#shippingCounty").val(),
        shipping_postCodeshippingInformation.find("#shippingPostCode").val()
        
      };

       
      //Simple validation
      var pageValidateText '';
      if (formObj.title === ''{
        pageValidateText += '\n' paymentInformation.find("#title").prev().text();
      }
      if (formObj.lastName === ''{
        pageValidateText += '\n' paymentInformation.find("#lastName").prev().text();
      }
      if (formObj.streetAddress === ''{
        pageValidateText += '\n' paymentInformation.find("#streetAddress").prev().text();
      }
      if (formObj.postCode === ''{
        pageValidateText += '\n' paymentInformation.find("#postCode").prev().text();
      }
      if (formObj.email === ''{
        pageValidateText += '\n' paymentInformation.find("#email").prev().text();
      }
      if (formObj.phone === ''{
        pageValidateText += '\n' paymentInformation.find("#phone").prev().text();
      }
      
      
      if (pageValidateText != ''{
        
        //The form does not validate and we pop up the result
        pageValidateText 'Remember to fill out' pageValidateText;
        alert(pageValidateText);
        return false//Return false and the browser will not send the user to the next step
      }

      /*
      The properties is sent to the server with a syncronous call
      This way we lock the UI and can redirect the user.
      */
      try {
        TeaCommerce.updateOrderProperties(formObjasyncfalse });
      }
      catch(e{
        alert(e);
      }
      return true//Return true and the browser will send the user to the next step
    }
  • Rune Grønkjær 1372 posts 3103 karma points
    Apr 10, 2012 @ 11:03
    Rune Grønkjær
    0

    Hi Phil,

    Try removing stuff from the javascript and see if you can get it working. That way you can narrow the problem down.

    /Rune

  • phil 58 posts 78 karma points
    Apr 10, 2012 @ 15:34
    phil
    0

    Hi Rune 

    I have tried removing stuf from the sendCustomerInformation and it gives teh same error everytime. when i tried 

    When i tried removing the code below (the only code in updateCartUI thats different that the starter kit it still gives teh same error.

    jQuery('#subTotal').text(order.TotalPriceWithoutFeesWithoutVATFormatted);
      jQuery('#vat').text(order.TotalVATFormatted);
      jQuery('#cartTotalQuantity').text(order.TotalQuantity);
      jQuery('#cartTotalPrice').text(order.TotalPriceFormatted);

    When i tried removing I got the error Reference Error: cartClass is not defined

    var cart jQuery('#cart'),cartClasses cart.attr('class').split(' '), cartStepClass '';

    I tried removing got the TypeError method split of underfined

     for(0cartClasses.lengthi++){
        if(cartClasses[i].indexOf('stepProgress'-1){
          cartStepClass cartClasses[i];
         break;
        }
      }

    Could it be an error with the line of code

    var cart jQuery('#cart'),cartClasses cart.attr('class').split(' '), cartStepClass '';
     
  • phil 58 posts 78 karma points
    Apr 10, 2012 @ 15:53
    phil
    0

    I have had a look through the starter kit code and my code 

    In your cart_step02.xslt file submit button you have an id of id="next" and in your teacommerce-Advanced.js file u have jQuery('#cart.stepProgress2 #next').live("click", function ()

    In my PersonalInformation.cshtml fiel I have a submit button with id="personalInfoSubmit" and in my teacommerce-Advanced.jsfile I have jQuery('#personalInfoSubmit').live("click"function ()

    do I need to call the cart I have tried #cart.stepProgress and just #cart but it doesn't work i put an alert("test"); right after it and it didn't get hit


  • phil 58 posts 78 karma points
    Apr 12, 2012 @ 15:06
    phil
    0

    I have solved the problem I needed to wrap the form inside a div with id & class of cart

    <div id="cart" class="cart">
    
Please Sign in or register to post replies

Write your reply to:

Draft