Esempio n. 1
0
include_once 'controller/ShoppingCartController.php';
include_once 'controller/ProductController.php';
include_once 'controller/CustomerController.php';
include_once 'controller/OrderController.php';
//Session wird gestartet
session_start();
//op = operation, Server übergibt den wert von 'op', von allen Server Variablen($_POST,$_GET,usw.)
@($op = $_REQUEST['op']);
//pr = productnummer die vom Shop ausgewählt wird, -1 weil Index bei 0 anfängt
@($pr = $_REQUEST['pr'] - 1);
//Controllers werden instanziert, damit wir ihre Funktionen im index brauchen können
$user_controller = new UserController();
$cart_controller = new ShoppingCartController();
$prod_controller = new ProductController();
$cust_controller = new CustomerController();
$order_controller = new orderController();
/*******************************
Anhand des Wertes von op, also der gesuchten Funktion im Index,
werden auf verschiedene Seiten gezeigt und /oder verschiedene Funktionen eines 
Controllers durchgeführt. z.B versucht der User einzuloggen wird im Forumular
über $_POST login button (mit name "op"!)die login Funktion des Indexes
aufgerufen. Ist die Authentifizierung erfolgreich wird der User auf den Shop
(ShopView.php) verlinkt. 
Alle Verlinkungen verlaufen durch den Index.
******************************/
switch ($op) {
    //verweist einen leeren op an die Loginseite (erste Ladung des Shops)
    case "":
        header("Location:./view/LoginView.php");
        break;
        //basic login logout operations
Esempio n. 2
0
 public function process()
 {
     global $db, $order, $user;
     //eDebug($order,true);
     if (!$user->isLoggedIn() && empty($this->params['nologin'])) {
         flash('message', gt("It appears that your session has expired. Please log in to continue the checkout process."));
         expHistory::back();
         //expHistory::redirecto_login(makeLink(array('module'=>'cart','action'=>'checkout'), 'secure'));
     }
     // if this error hits then something went horribly wrong or the user has tried to hit this
     // action themselves before the cart was ready or is refreshing the page after they've confirmed the
     // order.
     if (empty($order->orderitem)) {
         flash('error', gt('There are no items in your cart.'));
     }
     if (!expQueue::isQueueEmpty('error')) {
         redirect_to(array('controller' => 'store', 'action' => 'showall'));
     }
     // set the gift comments
     $order->update($this->params);
     // get the biling & shipping info
     $shipping = new shipping();
     $billing = new billing();
     // finalize the total to bill
     $order->calculateGrandTotal();
     //eDebug($order,true);
     $invNum = $order->getInvoiceNumber();
     // call the billing calculators process method - this will handle saving the billing options to the database.
     $result = $billing->calculator->process($billing->billingmethod, expSession::get('billing_options'), $this->params, $invNum);
     if (empty($result->errorCode)) {
         // if ($result->errorCode === "0" || $result->errorCode === 0)
         // {
         // save out the cart total to the database
         $billing->billingmethod->update(array('billing_cost' => $order->grand_total));
         // set the invoice number and purchase date in the order table..this finializes the order
         //$invoice_num = $db->max('orders', 'invoice_id') + 1;
         //if ($invoice_num < ecomconfig::getConfig('starting_invoice_number')) $invoice_num += ecomconfig::getConfig('starting_invoice_number');
         // get the first order status and set it for this order
         $order->update(array('invoice_id' => $invNum, 'purchased' => time(), 'updated' => time(), 'comment' => serialize($comment)));
         //$order->setDefaultStatus(); --FJD?
         //$order->setDefaultOrderType(); --FJD?
         $order->refresh();
         // run each items process callback function
         foreach ($order->orderitem as $item) {
             $product = new $item->product_type($item->product_id);
             $product->process($item, $order->order_type->affects_inventory);
         }
         $billing->calculator->postProcess($order, $this->params);
         orderController::clearCartCookie();
     } else {
         flash('error', gt('An error was encountered while processing your transaction.') . '<br /><br />' . $result->message);
         expHistory::back();
         //redirect_to(array('controller'=>'cart', 'action'=>'checkout'));
     }
     $billinginfo = $billing->calculator->userView(unserialize($billing->billingmethod->billing_options));
     if (!DEVELOPMENT) {
         // send email invoices to the admins & users if needed
         if ($order->order_type->emails_customer) {
             $invoice = renderAction(array('controller' => 'order', 'action' => 'email', 'id' => $order->id));
         }
     } else {
         flash('message', gt('Development on, skipping email sending.'));
     }
     //assign_to_template(array('order'=>$order, 'billing'=>$billing, 'shipping'=>$shipping, 'result'=>$result, 'billinginfo'=>$billinginfo));
     flash('message', gt('Your order has been submitted.'));
     redirect_to(array('controller' => 'order', 'action' => 'myOrder', 'id' => $order->id, 'tc' => 1));
 }
Esempio n. 3
0
 function print_orders()
 {
     global $db, $timer;
     //eDebug($this->params,true);
     //eDebug($timer->mark());
     //eDebug( expSession::get('order_print_query'));
     if (isset($this->params['applytoall']) && $this->params['applytoall'] == 1) {
         //$sql = expSession::get('order_print_query');
         //eDebug($sql);
         //expSession::set('product_export_query','');
         //$orders = $db->selectArraysBySql($sql);
         $obs = expSession::get('order_export_values');
         usort($obs, array("reportController", "sortPrintOrders"));
         foreach ($obs as $ob) {
             $orders[] = array('id' => $ob->id);
         }
         //eDebug($prods);
     } else {
         foreach ($this->params['act-upon'] as $order) {
             $orders[] = array('id' => $order);
         }
     }
     //eDebug("Done with print_orders: " . $timer->mark());
     //eDebug($orders,true);
     $oc = new orderController();
     $oc->getPDF($orders);
 }