Debug Realtime Shipping Methods?

that would should you the request and response from canada post, weird values come from 3 things…

weight per item… yes… friging weight adds up.



box size ( also you might have items per box in item options as well)

box weight…think that a canadapost option.



other should be same…



however i can't remember wher ethe heck ive seen where we can define boxes in there, used to see that…



dont think i need 3 canadapost posts for 3 box sizes right ?

Thanks Vanderex - we're working on FedEx issues now, but I suspect I can get this working on the FedEx method as well using this technique?



You must have recognized my Canadian accent, eh?

Interesting: I see at the relevant line from above that CS-Cart has commented as follows:



// FIXME: FexEx returned GROUND for international as "FEDEX_GROUND" and not INTERNATIONAL_GROUND
// We sent a request to clarify this situation to FedEx.
$intl_code = str_replace('INTERNATIONAL_', 'FEDEX_', $code);




Perhaps there's a bug at FedEx's end too to boot!

this is an old thread, but i cant seem to get 4.2.3 to show any shipping other then custom… ill try my own post to see ( was searching for answer when i got my old post ) lol

This is an old post, and my question refers to v2.1.4,

I know its an old version but, I needed to log to a file, the requests (and responses) sent to the Australia Post realtime calculator.

Ive added the code to AUP.PHP file which is logging to the file ,

file_put_contents("apost.log", implode(",", $request) . "\n",FILE_APPEND);
and:
file_put_contents("apost.log", "\n\n" . implode(",", $result) . "\n\n",FILE_APPEND);

It is now obvious that the auspost DRC is ignoring the country code for AU domestic shipping methods as the following string returns "OK" with a shipping cost!!!

http://drc.edeliver.com.au/ratecalc.asp?Pickup_Postcode=5153&Destination_Postcode=5153&Country=AF&Weight=272.16&Service_Type=STANDARD&Height=70&Width=220&Length=980

charge=7.45
days=2
err_msg=OK

Its basically sloppy programming on both sides:

A. CSCart's fn_get_aup_rates and sends out a request for Domestic shipping rates even tho the country code is not "AU".. And the fact that the default postcodes are sent out if none are entered in the estimator.

B: Ausposts programmer hasnt bothered to put in a check for country code == AU for domestic shipping.

Australia Post have made changes recently that cause the shipping estimator to return Domestic rates for international destinations. So Im currently talking to auspost to try and fix the latest bug they have introduced in the old, yet still available DRC for realtime shipping calculations.

Id like to add a skip in the aup.php code like:

if ( $location['country'] != "AU" && ($code == 'EXPRESS' || $code == 'STANDARD') {
} else {

but not sure where it should go. Help appreciated.

Ok, I guess theres not a huge base of v2.1.4 cscart users, but just in case anyone is needing a work around for the Auspost isue:

Ive added the following code into the /shippings/aup.php file:

Directly under:

if ( !defined('AREA') ) { die('Access denied'); }

function fn_get_aup_rates($code, $weight_data, $location, &$auth, $shipping_settings, $package_info, $origination, $service_id, $allow_multithreading = false)
{

add

// Mod to disable sending of Domestic requests if country not AU
if ($location['country'] != "AU" && ($code == 'EXPRESS' || $code == 'STANDARD')) {
		return false;
	}

Its not elegant as it hardcodes things that should never be... but just in case Auspost cant be bothered fixing their stuff-up...

If there is a better way, I'd be most appreciative.

Try to enable logging of HTTP/HTTPS requests on the Settings -> Logging page. Hope that you will be able to find necessary data in the default logs then

Thanks for the reply eComLabs,

This suggestion has already been proposed and as previously pointed out, the AusPost requests are not logged. We actually already had this enabled. It would be very handy indeed if it would, but it does not.

Try to use the following code:

file_put_contents('aup_log.txt', var_export ($data, true), FILE_APPEND);

where $data - is the variable which should be logged

if the aup_log.txt file is not created in the root directory of CS-Cart, create it manually