From: konrad Date: Mon, 7 Feb 2011 20:11:59 +0000 (+0000) Subject: implement place order X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=95470a1e6b2405c0431ee64bbe70497588efed46;p=web%2Fkonrad%2Fsmoke.git implement place order git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@721 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- diff --git a/wob/classes/cart.wolf b/wob/classes/cart.wolf index 6553e48..0c47b0a 100644 --- a/wob/classes/cart.wolf +++ b/wob/classes/cart.wolf @@ -93,6 +93,23 @@ + + + + + + + + + + + + + + + + + diff --git a/www/inc/rendering/cart_listing.php b/www/inc/rendering/cart_listing.php index 74b5784..f3b58c0 100644 --- a/www/inc/rendering/cart_listing.php +++ b/www/inc/rendering/cart_listing.php @@ -398,7 +398,26 @@ static public function changeAddressPage($mode) static public function placeOrder() { - die ("not implemented"); + global $basevars,$twig,$db; + //get cart object + $cartid=self::getCart(); + if($cartid==""){ + return $twig->loadTemplate("carterror.html")->render($basevars); + } + $cart=WOCartOrder::fromTablecart(WTcart::getFromDB($cartid)); + if(!is_a($cart,"WOCartOrder")){ + return $twig->loadTemplate("carterror.html")->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); + //go home + return $twig->loadTemplate("placeorder.html")->render($basevars); } //end of WebCart diff --git a/www/template/en/placeorder.html b/www/template/en/placeorder.html new file mode 100644 index 0000000..f8705a4 --- /dev/null +++ b/www/template/en/placeorder.html @@ -0,0 +1,16 @@ +{# Example Template for MagicSmoke + ================================ + this one is called after an order has been placed successfully +#} + +{% extends 'layout.html' %} + +{% block title %}Order Placed{% endblock %} + +{% block page %} + +Your order has been placed. You will receive confirmation via email.

+ +Continue shopping

+ +{% endblock %}