$paOrder->set_ship_zip($PostalCode);
         //ship to postal code
         $paOrder->set_ship_country(normalize_special_characters($Country));
         //ship to country name
         echo "if\r\n";
         var_dump($paOrder);
     } else {
         $paOrder->set_ship_add2(normalize_special_characters($City));
         //ship to address2
         $paOrder->set_ship_city(normalize_special_characters($State));
         //ship to city
         $paOrder->set_ship_state('');
         //ship to state
         $paOrder->set_ship_zip($PostalCode);
         //ship to postal code
         $paOrder->set_ship_country(normalize_special_characters($Country));
         //ship to country name
         echo "else\r\n";
         var_dump($paOrder);
     }
     $paOrder->set_ship_meth($ShippingMethod2);
     //ship method FDG=Ground, FD2=2nd Day, FDO=Overnight
     $paOrder->set_order_num($InvoiceId);
     //customer PO#
 }
 $items = $myOrder->getAllItems();
 $itemcount = count($items);
 // echo "number of items = ".$itemcount;
 // echo "\r\n";
 $name = array();
 $unitPrice = array();
    }
    if ($ret->responseStatus == 'Success') {
        $myOrder->setStatus('sent_to_pa');
        if ($apiMode == 'live') {
            //$myOrder->save();
            $state = "processing";
            $status = "sent_to_pa";
            $isCustomerNotified = FALSE;
            $comment = 'Changing state to Processing and status to sent_to_pa';
            $myOrder->setState($state, $status, $comment, $isCustomerNotified);
            $myOrder->save();
        }
        // echo "STATUS UPDATED: ".$myOrder->getStatus();
        $log->lwrite("Order Id " . $thisId . " success : " . $now . " \r");
        //DEBUG
        $log->lwrite("APIMODE = " . $apiMode . "\r");
        $log->lwrite($ret->orderFileXML . "\r");
        $log->lwrite("ORDERID = " . $thisId . " InvoiceId = " . $InvoiceId . " STATUS = " . $myOrder->getStatus() . " Customer Name = " . $CustomerName . " Address1 = " . $Address[0] . " Address2 = " . $Address[1] . " City = " . $City . " State = " . $State . " PostalCode = " . $PostalCode . " Country = " . $Country . " MagentoShipCode = " . $MagentoShipCode . " ShippingDescription = " . $MagentoShipDescription . " ShippingDescription = " . $MagentoShipDescription . " ShippingMethod2 = " . $ShippingMethod2 . "\r");
    } else {
        $log->lwrite("FAILED: Order Id " . $InvoiceId . "\r");
        $subject = "Error in PA Gateway - order submission: order failed";
        $body = "Submitting order " . $InvoiceId . " to paAPI failed. Response detail = " . $ret->responseDetail . " \r";
        mail($to, $subject, $body);
        $log->lwrite("ORDERID = " . $thisId . " InvoiceId = " . $InvoiceId . " STATUS = " . $myOrder->getStatus() . " Customer Name = " . normalize_special_characters($CustomerName) . " Address1 = " . normalize_special_characters($Address[0]) . " Address2 = " . normalize_special_characters($Address[1]) . " City = " . normalize_special_characters($City) . " State = " . normalize_special_characters($State) . " PostalCode = " . $PostalCode . " Country = " . normalize_special_characters($Country) . " MagentoShipCode = " . $MagentoShipCode . " ShippingDescription = " . $MagentoShipDescription . " ShippingDescription = " . $MagentoShipDescription . " ShippingMethod2 = " . $ShippingMethod2 . " Total paid = " . $myOrder->getTotal_paid() . "\r\n");
        $log->lwrite($ret->orderFileXML . "\r\n");
        continue;
    }
    /*	
    */
}
$log->lwrite("Script FINISHED.\r\n\r\n");
Example #3
0
function pdGetAnnounceData($radio_id)
{
    $query = "\n    select \n      `cities`.`name`, \n      `countries`.`name`, \n      `radios`.`name`\n    from `radios`\n    join `cities` \n    on `radios`.`city_id` = `cities`.`id`\n    join `countries` \n    on `cities`.`country_code` = `countries`.`iso` \n    where `radios`.`id` = '{$radio_id}'";
    $result = mysql_query($query) or header('HTTP/1.0 500 Internal Server Error');
    while (list($city, $country, $radio) = mysql_fetch_array($result)) {
        $city_clean = normalize_special_characters($city);
        $country_clean = normalize_special_characters($country);
        $radio_clean = normalize_special_characters($radio);
        echo "city {$city_clean};\n";
        echo "country {$country_clean};\n";
        echo "radio {$radio_clean};\n";
    }
}