From 3d132ff4760fdbf68db9b0d1d9ce7f95b8a90f74 Mon Sep 17 00:00:00 2001 From: Konrad Rosenbaum Date: Tue, 20 Mar 2012 19:08:58 +0100 Subject: [PATCH] add default address for online shopping --- www/inc/wext/customer.php | 10 ++++++++++ www/template/en/index.html | 2 +- 2 files changed, 11 insertions(+), 1 deletions(-) diff --git a/www/inc/wext/customer.php b/www/inc/wext/customer.php index cfe08f8..c411c61 100644 --- a/www/inc/wext/customer.php +++ b/www/inc/wext/customer.php @@ -484,14 +484,24 @@ class WOCustomer extends WOCustomerAbstract } //store in cart if($storeincart){ + //get cart $cartid=WebCart::getCart(); if($cartid==""){ $p=$twig->loadTemplate("carterror.html"); return $p->render($basevars); } + //get customer data $cart=WTcart::getFromDB($cartid); $cart->customerid=$ct->customerid; $cart->update(); + //get address if there is none yet + if($cart->deliveryaddress==false){ + $addrs=WTaddress::selectFromDB("customerid=".$ct->customerid,"ORDER BY lastused DESC"); + if(count($addrs)>0){ + $cart->deliveryaddress=$addrs[0]->addressid; + $cart->update(); + } + } } //store in session $sess=WOWebSession::getOrCreateWebSession(); diff --git a/www/template/en/index.html b/www/template/en/index.html index 95a058f..12ed001 100644 --- a/www/template/en/index.html +++ b/www/template/en/index.html @@ -14,7 +14,7 @@
  • Ticket Shop
  • Voucher Shop
  • Merchandising
  • -
  • My Shoping Cart
  • +
  • My Shopping Cart
  • {% endblock page %} -- 1.7.2.5