Copied to clipboard

Flag this post as spam?

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


  • Preethi 32 posts 99 karma points
    Sep 05, 2016 @ 11:35
    Preethi
    0

    Adding checkbox for shipping address

    Hi,

    I am trying to add a checkbox for the shipping in formation so that if it is checked the billing information is saved as shipping information. I have added this to cart.js

    //Shipping address check jQuery('body').on('click', '.cartContainer.information button[type=submit]', function () { if (jQuery('#saveDetails').is(':checked')) { var properties = { shippingfirstName: $("#inputFirstName").val(), shippinglastName: $("#inputLastName").val(), shippingcompany: $("#inputCompany").val(), shippingstreetAddress: $("#inputAddress").val(), shippingzipCode: $("#inputZipCode").val(), shippingcity: $("#inputCity").val()

          };
    
              TC.addOrUpdateOrderProperties(
                    {
                        properties: properties,
                        storeId: 2
                    });
    
    
      }
    

    The order properties are not getting saved though. I am not sure what else I have to add.

  • Preethi 32 posts 99 karma points
    Sep 06, 2016 @ 09:54
    Preethi
    0

    I plan on adding this checkbox as a custom property which can then be set and saved alongside the shipping details. Can somebody help me with my issue please. We are planning to go live soon.

    Also I would like to know how to obtain the storeId in the JavaScript api. I do have _storeId = @Model.Store; in my master template. Do I just use _storeId within the js.

  • Anders Burla 2560 posts 8256 karma points
    Sep 06, 2016 @ 10:00
    Anders Burla
    0

    Hi Preethi

    If you have the variable _storeId, then Tea Commerce will pick it up and you don't need to send it as a parameter to your methods.

    I would just save the checkbox value as you won't want your UI to have the billing info copied to the fields with shipping information. Then at the right point (properly when the order is finalized) you will use the Notification center to copy the values to the shipping info at that point. https://documentation.teacommerce.net/net-api/notification-center/

    Kind regards

    Anders

  • Preethi 32 posts 99 karma points
    Sep 06, 2016 @ 10:06
    Preethi
    0

    Hi Anders,

    Thanks for your reply. I was hoping to use javascript api for this. Can order properties not be updated using js? My main problem is TC.addOrUpdateOrderProperties within js is not updating or storing the property.

    Regards

    Preethi

  • Anders Burla 2560 posts 8256 karma points
    Sep 06, 2016 @ 10:47
    Anders Burla
    0

    Yes it can - just use this method.

    https://documentation.teacommerce.net/javascript-api/order-properties/addorupdateorderproperties/

    TC.addOrUpdateOrderProperties({storeId:1, properties: {firstName: 'Your', lastName: 'Name'}});
    

    Kind regards

    Anders

Please Sign in or register to post replies

Write your reply to:

Draft