From 48ec4b08033534d7625fbf91b87e7b7aa197b8fd Mon Sep 17 00:00:00 2001 From: Konrad Rosenbaum Date: Sat, 26 Sep 2015 22:58:43 +0200 Subject: [PATCH] make more data available for placing order page --- www/inc/rendering/cart_listing.php | 24 +++- www/template/en/layout.html | 2 +- www/template/en/placeorder.html | 211 ++++++++++++++++++++++++++++++++++++ 3 files changed, 230 insertions(+), 7 deletions(-) diff --git a/www/inc/rendering/cart_listing.php b/www/inc/rendering/cart_listing.php index b6a2772..e2126f3 100644 --- a/www/inc/rendering/cart_listing.php +++ b/www/inc/rendering/cart_listing.php @@ -409,15 +409,27 @@ static public function placeOrder() if(!is_a($cart,"WOCartOrder")){ return $twig->loadTemplate("carterror.html")->render($basevars); } + //get the web-object + $wcart = WOWebCart::fromTablecart(WTcart::getFromDB($cartid)); + if(!is_a($wcart,"WOWebCart")){ + //ooops. internal problem + $p=$twig->loadTemplate("carterror.html"); + return $p->render($basevars); + } //push it to order $trans=WTrCreateOrder::execute($cart,false); //delete cart - $where="cartid = ".$db->escapeString($cartid); - $db->deleteRows("cartticket",$where); - $db->deleteRows("cartvoucher",$where); - $db->deleteRows("cartitem",$where); - $db->deleteRows("cart",$where); + if($trans->resultorder()!==false){ + $where="cartid = ".$db->escapeString($cartid); + $db->deleteRows("cartticket",$where); + $db->deleteRows("cartvoucher",$where); + $db->deleteRows("cartitem",$where); + $db->deleteRows("cart",$where); + } //go home + $basevars['incart']=$wcart; + $basevars['order']=$trans->resultorder(); + $basevars['outcart']=$trans->resultcart(); return $twig->loadTemplate("placeorder.html")->render($basevars); } @@ -427,4 +439,4 @@ static public function placeOrder() //eof return; -?> \ No newline at end of file +?> diff --git a/www/template/en/layout.html b/www/template/en/layout.html index 6918383..9f03af6 100644 --- a/www/template/en/layout.html +++ b/www/template/en/layout.html @@ -20,7 +20,7 @@ {% endfor %} {% endif %}
-
Session: {{sessionid}}
+
Session: {{sessionid}}; Welcome to MagicSmoke {{user.title}} {{user.name}} ({{user.email}})

diff --git a/www/template/en/placeorder.html b/www/template/en/placeorder.html index f8705a4..ad8acfc 100644 --- a/www/template/en/placeorder.html +++ b/www/template/en/placeorder.html @@ -13,4 +13,215 @@ Your order has been placed. You will receive confirmation via email.

Continue shopping

+


+ +{# ###################################################################### + CART +####################################################################### #} + + +

Customer

+ + {{incart.customer.title}} {{incart.customer.name}}, {{incart.customer.firstname}} + +

Invoice Address

+ + {% if incart.invoiceaddress|isObject %} + {{incart.invoiceaddress.name}}
+ {{incart.invoiceaddress.addr1}}
+ {{incart.invoiceaddress.addr2}}
+ {{incart.invoiceaddress.zipcode}} {{incart.invoiceaddress.city}}, {{incart.invoiceaddress.state}}
+ {{incart.invoiceaddress.country.name}} + {% else %} + No invoice address. + {% endif %} + +

Delivery Address

+ + {% if incart.deliveryaddress|isObject %} + {{incart.deliveryaddress.name}}
+ {{incart.deliveryaddress.addr1}}
+ {{incart.deliveryaddress.addr2}}
+ {{incart.deliveryaddress.zipcode}} {{incart.deliveryaddress.city}}, {{incart.deliveryaddress.state}}
+ {{incart.deliveryaddress.country.name}} + {% else %} + Same as invoice address. + {% endif %} + +

Cart Items

+ {# build a table with all the items of this shopping cart: + this is the headline: #} + + + + {# go through tickets and render them #} + {% for ticket in incart.tickets %} + {% set pricesum=ticket.price * ticket.amount %} + + + + + + + {% endfor %} + + {# now go through vouchers #} + {% for voucher in incart.vouchers %} + + + + + + + {% endfor %} + + {# TODO: go through product items #} + + {# render the shipping option #} + {% if incart.shipping|isObject %} + + + + + {% else %} + + {% endif %} + + {# the overall sum of the above items... #} + + + {# end of the table #} +
ItemItem PriceAmountSum
Ticket: {{ticket.event.title}} ({{ticket.eventprice.pricecategory.name}}){{ticket.price|asMoney}}{{ticket.amount}}{{pricesum|asMoney}}
Voucher{{voucher.value|asMoney}}1{{voucher.value|asMoney}}
Shipping: {{incart.shipping.description}}{{incart.shipping.cost|asMoney}}1{{incart.shipping.cost|asMoney}}
No Shipping{{0|asMoney}}
Sum:{{incart.totalsum|asMoney}}
+ + +
+{# ###################################################################### + ORDER +####################################################################### #} + +{% if order|isObject %} +

Order No. {{order.orderid}}

+ +

Customer

+ + {{order.customer.title}} {{order.customer.name}}, {{order.customer.firstname}} + +

Invoice Address

+ + {% if order.invoiceaddress|isObject %} + {{order.invoiceaddress.name}}
+ {{order.invoiceaddress.addr1}}
+ {{order.invoiceaddress.addr2}}
+ {{order.invoiceaddress.zipcode}} {{order.invoiceaddress.city}}, {{order.invoiceaddress.state}}
+ {{order.invoiceaddress.country.name}} + {% else %} + No invoice address. + {% endif %} + +

Delivery Address

+ + {% if order.deliveryaddress|isObject %} + {{order.deliveryaddress.name}}
+ {{order.deliveryaddress.addr1}}
+ {{order.deliveryaddress.addr2}}
+ {{order.deliveryaddress.zipcode}} {{order.deliveryaddress.city}}, {{order.deliveryaddress.state}}
+ {{order.deliveryaddress.country.name}} + {% else %} + Same as invoice address. + {% endif %} + +

Cart Items

+ {# build a table with all the items of this shopping cart: + this is the headline: #} + + + + {# go through tickets and render them #} + {% for ticket in order.tickets %} + + + + + + {% endfor %} + + {# now go through vouchers #} + {% for voucher in order.vouchers %} + + + + + {% endfor %} + + {# TODO: go through product items #} + + {# render the shipping option #} + {% if order.shippingtype|isObject %} + + + {% else %} + + {% endif %} + + {# the overall sum of the above items... #} + + + {# end of the table #} +
IDItemItem Price
Ticket: {{ticket.ticketid}}{{ticket.event.title}} ({{ticket.pricecategory.name}}){{ticket.price|asMoney}}
Voucher: {{voucher.voucherid}}{{voucher.value|asMoney}}
Shipping: {{order.shippingtype.description}}{{order.shippingcosts|asMoney}}
No Shipping{{0|asMoney}}
Sum:{{order.totalprice|asMoney}}
+ +{% else %} +ARRRRGGHHHHHH! +{% endif %} + +
+ +{# ###################################################################### + Problem-Cart +####################################################################### #} + +{% if outcart|isObject %} + +

Cart Items

+ {# build a table with all the items of this shopping cart: + this is the headline: #} + + + + {# go through tickets and render them #} + {% for ticket in outcart.tickets %} + {% set pricesum=ticket.price * ticket.amount %} + + + + + + + + {% endfor %} + + {# now go through vouchers #} + {% for voucher in incart.vouchers %} + + + + + + + + {% endfor %} + + {# TODO: go through product items #} + + {# end of the table #} +
ItemItem PriceAmountSum
Ticket: {{ticket.event.title}} ({{ticket.eventprice.pricecategory.name}}){{ticket.price|asMoney}}{{ticket.amount}}{{pricesum|asMoney}}{{ticket.str_status}}
Voucher{{voucher.value|asMoney}}1{{voucher.value|asMoney}}{{voucher.str_status}}
+ + +{% endif %} + + +{# ###################################################################### + End of Page +####################################################################### #} + {% endblock %} + -- 1.7.2.5