Example #1
0
function payGetPaymentModuleById($PID, $paymentModulesFiles)
{
    $paymentModules = modGetModules($paymentModulesFiles);
    $currentPaymentModule = null;
    foreach ($paymentModules as $paymentModule) {
        if ((int) $paymentModule->get_id() == (int) $PID) {
            $currentPaymentModule = $paymentModule;
            break;
        }
    }
    return $currentPaymentModule;
}
Example #2
0
 function _getShippingCosts($shipping_methods, $order, $moduleFiles)
 {
     if (!isset($_SESSION["receiver_countryID"]) || !isset($_SESSION["receiver_zoneID"])) {
         return NULL;
     }
     $shipping_modules = modGetModules($moduleFiles);
     $shippingAddressID = 0;
     $shipping_costs = array();
     $res = cartGetCartContent();
     $sh_address = array("countryID" => $_SESSION["receiver_countryID"], "zoneID" => $_SESSION["receiver_zoneID"]);
     $addresses = array($sh_address, $sh_address);
     $j = 0;
     foreach ($shipping_methods as $shipping_method) {
         $_ShippingModule = modGetModuleObj($shipping_method["module_id"], SHIPPING_RATE_MODULE);
         if ($_ShippingModule) {
             if ($_ShippingModule->allow_shipping_to_address($sh_address)) {
                 $shipping_costs[$j] = oaGetShippingCostTakingIntoTax($res, $shipping_method["SID"], $addresses, $order);
             } else {
                 $shipping_costs[$j] = array(array('rate' => -1));
             }
         } else {
             $shipping_costs[$j] = oaGetShippingCostTakingIntoTax($res, $shipping_method["SID"], $addresses, $order);
         }
         $j++;
     }
     $_i = count($shipping_costs) - 1;
     for (; $_i >= 0; $_i--) {
         $_t = count($shipping_costs[$_i]) - 1;
         for (; $_t >= 0; $_t--) {
             if ($shipping_costs[$_i][$_t]['rate'] > 0) {
                 $shipping_costs[$_i][$_t]['rate'] = show_price($shipping_costs[$_i][$_t]['rate']);
             } else {
                 if (count($shipping_costs[$_i]) == 1 && $shipping_costs[$_i][$_t]['rate'] < 0) {
                     $shipping_costs[$_i] = 'n/a';
                 } else {
                     $shipping_costs[$_i][$_t]['rate'] = '';
                 }
             }
         }
     }
     return $shipping_costs;
 }