var checkoutString = "Total Price: " + totalPrice + "\nTotal Quantity: " + totalQuantity; checkoutString += "\n\n id \t name \t summary \t price \t quantity \t image path"; $.each( products, function () { checkoutString += ( "\n " + this.id + " \t " + this.name + " \t " + this.summary + " \t " + this.price + " \t " + this.quantity + " \t " + this.image ); } ); alert( checkoutString ) console.log( "checking out", products, totalPrice, totalQuantity ); // Create Order and redirect to paid page $.post( SITEURL + 'developer/index/cartcreate', { 'products': products }, function ( data ) { //console.log(data); window.location.href = SITEURL + "payment/?ordersn=" + data; } ); }, getDiscountPrice: function ( products, totalPrice, totalQuantity ) { console.log( "calculating discount", products, totalPrice, totalQuantity ); return totalPrice * 0.5; } } ); $( "#addNewProduct" ).click( function ( event ) { var currentElementNo = $( ".row" ).children().length + 1; $( ".row" ).append( '

product ' + currentElementNo + ' - $' + currentElementNo + '
Details
' ) } ); }); /*$( ".tour_right_search .arrow_down" ).click( function () { if ( $( this ).parent().parent().children( '.linkbox' ).css( 'height' ) == '95px' ) { $( this ).parent().parent().children( '.linkbox' ).css( 'height', 'auto' ); $( this ).children( '.fa' ).attr( 'class', 'fa fa-chevron-up' ); } else { $( this ).parent().parent().children( '.linkbox' ).css( 'height', '95' ); $( this ).children( '.fa' ).attr( 'class', 'fa fa-chevron-down' ); } } );*/ // Add click event dynamically $(document).on("click", ".toggle-text-button", function() { // Check if text is more or less if ($(this).text() == "See All") { // Change link text $(this).text("Less"); // Travel up DOM tree to parent, then find any children with CLASS .toggle-text and slide down $(this).parent().children(".toggle-text").slideDown(); } else { // Change link text $(this).text("See All"); // Travel up DOM tree to parent, then find any children with CLASS .toggle-text and slide up $(this).parent().children(".toggle-text").slideUp(); } });