undefined
alert
number:
timePlaced: Tue Aug 21 14:36:35 MST 2018
cart: [object Object]
client: [object Object]
paymentMethodID:
paymentMethod: null
shippingAmount: 0
paymentCharge: 0
totalAmount: 0
status: unconfirmed
page: null
numberStorageCookie: order_nr
init: function() { if ((typeof number == "number" && number > 0) || (typeof number == "string" && number != "")) { var page = Alek.getPage({ template: Shop.templates["order"].id, visibility: "*", title: number }); if (page.id > 0) { this.number = page.title; this.timePlaced = page.timeModified; this.client.id = page.getValue(Shop.getVariableName("order.client_id"), 0); this.client.firstName = page.getValue(Shop.getVariableName("order.first_name")); this.client.lastName = page.getValue(Shop.getVariableName("order.last_name")); this.client.address = page.getValue(Shop.getVariableName("order.address")); this.client.postCode = page.getValue(Shop.getVariableName("order.post_code")); this.client.city = page.getValue(Shop.getVariableName("order.city")); this.client.state = page.getValue(Shop.getVariableName("order.state")); this.client.country = page.getValue(Shop.getVariableName("order.country")); this.client.phone = page.getValue(Shop.getVariableName("order.phone")); this.client.email = page.getValue(Shop.getVariableName("order.email")); this.cart.inject(page.getValue(Shop.getVariableName("order.order"))); this.setPaymentMethod(page.getValue(Shop.getVariableName("order.payment_method"))); this.shippingAmount = parseFloat(page.getValue(Shop.getVariableName("order.shipping_amount"))); this.paymentCharge = parseFloat(page.getValue(Shop.getVariableName("order.payment_charge"))); this.totalAmount = parseFloat(page.getValue(Shop.getVariableName("order.total_amount"))); this.status = page.getValue(Shop.getVariableName("order.order_status")); this.page = page; } } }
setPaymentMethod: function(paymentMethodID) { if (typeof paymentMethodID == "undefined") var paymentMethodID = this.paymentMethodID; if (Shop.paymentMethods[paymentMethodID]) { this.paymentMethodID = paymentMethodID; this.paymentMethod = Shop.paymentMethods[paymentMethodID]; } this.count(); }
takeFormData: function() { var fieldMap = { "first_name": "firstName", "last_name": "lastName", "address": "address", "post_code": "postCode", "city": "city", "state": "state", "country": "country", "phone": "phone", "email": "email" }; for (var fieldName in fieldMap) if (String(Request.Form(fieldName)) != "undefined") { this.client[fieldMap[fieldName]] = String(Request.Form(fieldName)); } if (Request.Form("payment_method")) this.setPaymentMethod(Request.Form("payment_method")); }
count: function() { var shippingAmount = 0; var paymentCharge = 0; var totalAmount = 0; if (this.cart.shippable) { var totalWeight = this.cart.totalWeight; var weightCategory; switch (true) { case totalWeight < 0.1: weightCategory = 0; break; case totalWeight < 0.5: weightCategory = 1; break; case totalWeight < 1: weightCategory = 2; break; case totalWeight < 2: weightCategory = 3; break; default: weightCategory = 4; } var country = this.client.country; Shop.getShippingZones().each(function(zone) { if (zone.countries.contains(country)) shippingAmount = zone.categories[weightCategory]; }); } var subtotal = this.cart.totalAmount + shippingAmount; if (this.paymentMethod && this.paymentMethod.charge != "") { if (String(this.paymentMethod.charge).contains("%")) { var percentage = parseFloat(this.paymentMethod.charge); paymentCharge = subtotal * (percentage / 100); } else paymentCharge = parseFloat(this.paymentMethod.charge); } this.shippingAmount = shippingAmount; this.paymentCharge = paymentCharge; this.totalAmount = this.cart.totalAmount + this.shippingAmount + this.paymentCharge; }
save: function() { if (BaseKit.conn.isMySQL) BaseKit.execSQL("LOCK TABLES " + Alek.t.pages + " WRITE, " + Alek.t.content + " WRITE, " + Alek.t.events + " WRITE", true); if (this.number == "" && this.status == "unconfirmed") { var dsLastOrder = new DataSet("SELECT MAX(title) AS HighestNr FROM " + Alek.t.pages + (BaseKit.conn.isMSSQL ? " WITH (TABLOCK)" : "") + " WHERE title LIKE 'UNCONF_%' AND template_id = " + Shop.templates["order"].id + " AND status = " + PAGE_ACTIVE); this.number = Number(String(dsLastOrder.read("HighestNr", 999)).replace(/\D/g, "")) + 1; this.number = "UNCONF_" + this.number; } else if ((this.number == "" || this.number.contains("UNCONF")) && this.status != "unconfirmed") { var dsLastOrder = new DataSet("SELECT MAX(title) AS HighestNr FROM " + Alek.t.pages + (BaseKit.conn.isMSSQL ? " WITH (TABLOCK)" : "") + " WHERE title NOT LIKE 'UNCONF_%' AND template_id = " + Shop.templates["order"].id + " AND status = " + PAGE_ACTIVE); this.number = Number(String(dsLastOrder.read("HighestNr", 999)).replace(/\D/g, "")) + 1; Shop.log("Order assigned number " + this.number + " - " + this.cart.totalQuantity + " items in cart (" + Shop.currencySymbol + " " + this.cart.totalAmount.formatMoney() + ")"); } if (this.numberStorageCookie != null) setCookie(this.numberStorageCookie, this.number); if (this.page == null) { this.page = new Alek.Page({ parent: Shop.pages["unconfirmed"].id, template: Shop.templates["order"].id, isFolder: false, visibility: Alek.PAGE_INVISIBLE, language: Site.defaultLanguageCode, createdBy: 0 }); } this.page.title = this.number; if (this.status != "unconfirmed") this.page.setParent(Shop.pages["orders"].id); this.page.save(); if (BaseKit.conn.isMySQL) BaseKit.execSQL("UNLOCK TABLES", true); this.count(); var values = {}; if (this.client.firstName) { values[Shop.getVariableName("order.client_id")] = this.client.id; values[Shop.getVariableName("order.first_name")] = this.client.firstName; values[Shop.getVariableName("order.last_name")] = this.client.lastName; values[Shop.getVariableName("order.address")] = this.client.address; values[Shop.getVariableName("order.post_code")] = this.client.postCode; values[Shop.getVariableName("order.city")] = this.client.city; values[Shop.getVariableName("order.state")] = this.client.state; values[Shop.getVariableName("order.country")] = this.client.country; values[Shop.getVariableName("order.phone")] = this.client.phone; values[Shop.getVariableName("order.email")] = this.client.email; } values[Shop.getVariableName("order.order")] = this.cart.toOrderString(); values[Shop.getVariableName("order.payment_method")] = this.paymentMethodID; values[Shop.getVariableName("order.shipping_amount")] = this.shippingAmount; values[Shop.getVariableName("order.payment_charge")] = this.paymentCharge; values[Shop.getVariableName("order.total_amount")] = this.totalAmount; values[Shop.getVariableName("order.order_status")] = this.status; this.page.setValues(values); }
confirm: function() { return this.paymentMethod && this.paymentMethod.useForOrder(this); }
verifyPayment: function() { if (this.status == "sold") return true; var verified = this.paymentMethod && this.paymentMethod.verifyPayment(this); if (verified && this.status.among("unconfirmed", "awaiting payment")) { this.status = "confirmed"; this.processSale(); } return verified; }
processSale: function() { if (this.status != "confirmed") return false; var orderNr = this.number; this.cart.rows.each(function(row) { if (row.productID > 0 && row.quantity > 0) { var product = new Product(row.productID); Shop.log("Order " + orderNr + " sold - Product '" + row.fullName + "' [" + product.id + "] stock mutation: " + product.stock + " to " + (product.stock - row.quantity)); product.page.setValue(Shop.getVariableName((product.templateID == Shop.templates["product"].id ? "product" : "product variant") + ".stock"), product.stock - row.quantity); } }); this.status = "sold"; this.sendEmail("seller_confirmation"); this.sendEmail("buyer_confirmation"); this.save(); Alek.redirect(Site.getLiveLink("?shop=complete") + "&payment_method=" + this.paymentMethodID); return true; }
getEmail: function(emailType) { if (typeof emailType == "undefined") var emailType = "seller_confirmation"; var mail = new Mail(); switch (emailType) { case "seller_confirmation": mail.subject = "Confirmation for order by " + this.client.firstName + " " + this.client.lastName; mail.to = Shop.emailAddresses.sales; mail.replyTo = this.client.email; break; case "buyer_confirmation": mail.subject = "Your order from " + Shop.title; mail.to = this.client.email; mail.replyTo = Shop.emailAddresses.sales; break; } mail.body = "<style>" + Shop.emailCSS + "</style><body>" + Shop.emailHeader + "<h1>Order " + this.number + "</h1>" + this.timePlaced.format("long") + "
" + "<table cellspacing=0 cellpadding=4 border=0>" + "<tr><td><b>Quantity</b></td><td><b>Product</b></td><td><b>Price</b></td><td><b>Subtotal</b></td></tr>"; this.count(); this.cart.rows.each(function(row) { var product = new Product(row.productID); if (row.quantity > 0) mail.body += "<tr><td>" + row.quantity + "</td><td>" + (product.isPreOrder ? "PRE-ORDER: " : "") + product.name + "</td><td>" + Shop.currencySymbol + " " + row.price.formatMoney() + "</td><td>" + Shop.currencySymbol + " " + (row.quantity * row.price).formatMoney() + "</td></tr>"; }); mail.body += "</table>" + "
" + "<table>" + (this.shippingAmount > 0 ? "<tr><td><b>Shipping</b></td><td>" + Shop.currencySymbol + " " + this.shippingAmount.formatMoney() + "</td></tr>" : "") + (this.paymentCharge > 0 ? "<tr><td><b>" + this.paymentMethod.description.cap() + " charge</b></td><td>" + Shop.currencySymbol + " " + this.paymentCharge.formatMoney() + "</td></tr>" : "") + "<tr><td colspan=2><hr></td></tr>" + "<tr><td><b>Total</b></td><td>" + Shop.currencySymbol + " " + this.totalAmount.formatMoney() + "</td></tr>" + "</table>" + "
" + "<h1>Payment</h1>" + "<table>" + "<tr><td><b>Payment method</b></td><td>" + (this.paymentMethod ? this.paymentMethod.description : "") + "</td></tr>" + "<tr><td><b>Payment status</b></td><td>" + (this.status == "sold" ? "Paid" : "Awaiting payment") + "</td></tr>" + "</table>" + "
" + "<h1>Delivery address</h1>" + this.client.firstName + " " + this.client.lastName + "
" + this.client.address + "
" + this.client.postCode + " " + this.client.city + "
" + (typeof this.client.state == "undefined" || this.client.state == "" ? "" : this.client.state + "
") + this.client.country + "
" + "
" + (typeof this.client.phone == "undefined" || this.client.phone == "" ? "" : "Phone: " + this.client.phone + "
") + "<a href='mailto:" + this.client.email + "'>" + this.client.email + "</a>" + "</body>"; if (emailType == "buyer_confirmation") { if (this.paymentMethod && this.paymentMethod.buyerInstructionsPageID > 0) { var pagInstructions = Alek.getPage(this.paymentMethod.buyerInstructionsPageID); if (pagInstructions.id > 0) { mail.body += "
" + "<h1>Payment instructions</h1>" + pagInstructions.get(); } } } return mail; }
sendEmail: function(emailType) { var mail = this.getEmail(emailType); return mail.send(); }
Tyler Wentworth Fashion : Sketchbook Savy - Laure Belle Couture || shop || Integrity Toys & other dolls

Tyler Wentworth Fashion : Sketchbook Savy

€ 60,00
From the Tonner Doll Company, NRFB costume for 16" doll
1250 ms