Exemplo n.º 1
0
 function getShippingArray()
 {
     if (!class_exists('vmPSPlugin')) {
         require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php';
     }
     JPluginHelper::importPlugin('vmshipment');
     // lets create a new instance of the cart
     if (!class_exists('VirtueMartCart')) {
         require JPATH_VM_SITE . DS . 'helpers' . DS . 'cart.php';
     }
     $cart = VirtueMartCart::getCart(false, false);
     //For the selection of the shipment method we need the total amount to pay.
     require_once JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'mini.php';
     $shipmentModel = OPCloader::getMini('Shipmentmethod');
     $shipments = $shipmentModel->getShipments();
     return $shipments;
     foreach ($shipments as &$s) {
         $cartData['shipmentName'] = OPCLang::_('COM_VIRTUEMART_CART_NO_SHIPMENT_SELECTED');
         $cartPrices['shipmentValue'] = 0;
         //could be automatically set to a default set in the globalconfig
         $cartPrices['shipmentTax'] = 0;
         $cartPrices['shipmentTotal'] = 0;
         $cartPrices['salesPriceShipment'] = 0;
         $savedc = $cart;
         $cart->virtuemart_shipmentmethod_id = $s->virtuemart_shipmentmethod_id;
         $cart->automaticSelectedShipment = true;
         $cart->setCartIntoSession();
         $returnValues = $dispatcher->trigger('calculateSalesPrice', array(&$cart, &$s, &$cart->priceUnformatted));
         $found_shipment_method = false;
         $shipment_not_found_text = OPCLang::_('COM_VIRTUEMART_CART_NO_SHIPPING_METHOD_PUBLIC');
         $shipments_shipment_rates = array();
         $s->op_prices = $cartPrices;
         $s->op_name = $cartData;
         $cart = $savedc;
     }
     return $shipments;
     if (empty($shipments)) {
         // we have no shipping method avaiable
         define('NO_SHIPPING', '0');
     }
     $selectedShipment = empty($cart->virtuemart_shipmentmethod_id) ? 0 : $cart->virtuemart_shipmentmethod_id;
     $shipments_shipment_rates = array();
     //JPluginHelper::importPlugin('vmshipment');
     $dispatcher = JDispatcher::getInstance();
     unset($_SESSION['load_fedex_prices_from_session']);
     $returnValues = $dispatcher->trigger('plgVmDisplayListFEShipment', array($cart, $selectedShipment, &$shipments_shipment_rates));
     // if no shipment rate defined
     $found_shipment_method = false;
     foreach ($returnValues as $returnValue) {
         if ($returnValue) {
             $found_shipment_method = true;
             break;
         }
     }
     $shipment_not_found_text = OPCLang::_('COM_VIRTUEMART_CART_NO_SHIPPING_METHOD_PUBLIC');
     return;
     $ret = '';
     // if only one Shipment , should be checked by default
     foreach ($shipments_shipment_rates as $shipment_shipment_rates) {
         if (is_array($shipment_shipment_rates)) {
             foreach ($shipment_shipment_rates as $shipment_shipment_rate) {
                 $ret .= $shipment_shipment_rate . '<br />';
             }
         }
     }
     return $ret;
 }