示例#1
0
 function shippingRequest()
 {
     $task = JRequest::getVar('task');
     switch ($task) {
         case "loadshipcost":
             //doing Ship calculation
             $cfg = new sc_configuration();
             $taxonshipping = $cfg->get("taxonshipping");
             $shipPoints = shippingRequest::countPoints();
             $shipRegion = JRequest::getVar('shipRegion');
             $shipCost = fshipping::calculateShipCost($shipPoints, $shipRegion);
             $readyShipCost = shippingRequest::displayValue($shipCost);
             //update sub total
             $subTotal = shippingRequest::getSubTotalFromCartContents();
             $readySub = shippingRequest::displayValue($subTotal);
             if ($taxonshipping == 1) {
                 $subTotal = $subTotal + $shipCost;
             }
             //update tax if applicable
             $ctax = new taxes();
             $taxrate = $ctax->getTax($shipRegion);
             $tax = $subTotal * $taxrate;
             $readyTax = shippingRequest::displayValue($tax);
             if ($taxonshipping == 0) {
                 $subTotal = $subTotal + $shipCost;
             }
             //update Gtotal
             $gTotal = $tax + $subTotal;
             $readygTotal = shippingRequest::displayValue($gTotal);
             echo "{$readyShipCost}|{$readySub}|{$readyTax}|{$readygTotal}";
             break;
     }
 }
示例#2
0
文件: caddy.php 项目: bizanto/Hooked
     break;
 case "refresh":
     $v = new vouchers();
     $v->getvoucherinfo();
     $mainframe->redirect("index.php?option=com_caddy&action=checkout");
     break;
 case "allconfirm":
     $errors = checkerrors();
     $cfg = new sc_configuration();
     if ($errors == 0) {
         $cart = new cart2();
         $mycart = $cart->readCart();
         $ship['enabled'] = $cfg->get('shippingenabled');
         if ($ship['enabled']) {
             $ship['region'] = JRequest::getVar('shipRegion');
             $ship['cost'] = fshipping::calculateShipCost(fshipping::getTotalPointsFromCart($mycart), $ship['region']);
         }
         // store the order first
         $order = new orders();
         $orderid = $order->store_new_order($mycart, $ship);
         $usePayPal = $cfg->get("usepaypal");
         if ($usePayPal == 1) {
             $gateway = $cfg->get("pgclassname");
             if ($gateway != "") {
                 // check the gateway filename
                 if (!class_exists($gateway)) {
                     $pgpath = dirname($mainframe->getPath('class'));
                     $pgfile = $pgpath . DS . $gateway . ".class.php";
                     // filename should look like "scpaypal.class.php"
                     if (!file_exists($pgfile)) {
                         echo "The classname you provided in the configuration does not correspond to a known file ({$pgfile})";