<Property name="tickets" type="List:CartTicket"/>
<Property name="vouchers" type="List:CartVoucher"/>
<Property name="items" type="List:CartItem"/>
+
+ <Mapping table="cart">
+ <Map property="customerid"/>
+ <Map property="deliveryaddressid" column="deliveryaddress"/>
+ <Map property="invoiceaddressid" column="invoiceaddress"/>
+ <Map property="comment"/>
+ <Map property="shippingtypeid" column="shippingtype"/>
+ <Map property="tickets">
+ <Call lang="php" method="WOCartTicket::fromTableArraycartticket(WTcartticket::selectFromDB('cartid='.$GLOBALS['db']->escapeString($table->cartid)))"/>
+ </Map>
+ <Map property="vouchers">
+ <Call lang="php" method="WOCartVoucher::fromTableArraycartvoucher(WTcartvoucher::selectFromDB('cartid='.$GLOBALS['db']->escapeString($table->cartid)))"/>
+ </Map>
+ <Map property="items">
+ <Call lang="php" method="WOCartItem::fromTableArraycartitem(WTcartitem::selectFromDB('cartid='.$GLOBALS['db']->escapeString($table->cartid)))"/>
+ </Map>
+ </Mapping>
</Class>
<Class name="WebCart">
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
--- /dev/null
+{# 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.<p/>
+
+<a href="{{script.root}}">Continue shopping</a><p/>
+
+{% endblock %}