Re: ozpost shipping module
I just installed ozpost 3.6.0 (upgraded to 3.6.2) in an XAMPP test account (Windows 7, PHP 5.4.8, Zen Cart v1.5.3) and receive the following message when I attempt to install the shipping module:
Code:
Unable to create temporary files. ClickNSend will be non functional and you will be unable to enter product dimensions until this is rectified
Looking in my logs folder, I saw some log files and added a bit to the ozpost.php file to try to see what's going on:
Code:
[01-Aug-2014 22:47:20 Australia/Victoria] writeTempFile (C:\xampp\htdocs\zen_new\admin_name/, includes/modules/product/, collect_info.php): C:/xampp/htdocs/zen_new/cache/ozpost/C:\xampp\htdocs\zen_new\admin_name/ : C:/xampp/htdocs/zen_new/cache/ozpost/C:\xampp\htdocs\zen_new\adminsdoc/includes/modules/product/
[01-Aug-2014 22:47:20 Australia/Victoria] PHP Warning: mkdir(): Invalid argument in C:\xampp\htdocs\zen_new\includes\modules\shipping\ozpost.php on line 3087
The part I added shows the parameters passed to the writeTempFile function, followed by the $cachefolder value, followed by the $myFolder value. You can see why mkdir was throwing a warning!
Any guidance would be much appreciated.
Re: ozpost shipping module
Quote:
Originally Posted by
lat9
I just installed ozpost 3.6.0 (upgraded to 3.6.2) in an XAMPP test account (Windows 7, PHP 5.4.8, Zen Cart v1.5.3)
<gulp> I've been kind of dreading the day that someone decided to try ozpost on a windows based server because I've had strong suspicions for several years now that it wouldn't work without modifications due to some rather slack coding in a few places.
Quote:
Originally Posted by
lat9
The part I added shows the parameters passed to the writeTempFile function, followed by the $cachefolder value, followed by the $myFolder value. You can see why mkdir was throwing a warning!
Any guidance would be much appreciated.
The problem(s) as I see it, is because *nix based systems uses forward slashes for its folder/path separators and windows uses back\slashes.
The ozpost module has several places where the forward slashes are hardcoded, so these will need to be replaced with backslashes.
I honestly don't know the extent of the changes needed to make it work because I'd always figured that I'd wait until someone actually finds it to be a problem before delving into it. I guess that after all these years that time has finally come.
The main issue for me at the moment is that I'm heavily involved in doing ozpost updates for other eCommerce systems (to bring them up to the same level of features and functionality that ZenCart merchants enjoy) so it could be a while before I can get back to this...
Just to compound matters, if it were almost anyone other than you reporting the issue I'd be giving it a lot higher priority than I'm going to. The reason being is that I know that you are pretty clued up in regards to PHP coding (In fact you have taken me a little by surprise that you even use XAMPP) and I don't think you'll have any headaches in locating and making the needed changes yourself. Of course, the easiest solution would be to use a *nix server rather than a windows server.
I suppose that now this cat is out of the bag I don't have much option than to take Windows users into consideration with future updates. I have enjoyed a very good run without having to do this though. I suspect it will take a few more weeks to get onto it though, which leaves you with the choice of putting your own skills to use for a fast resolution, waiting a few weeks for a windows compatible version, or installing it on a *nix based server instead.
Cheers
RodG
Re: ozpost shipping module
Rod, it's only a local XAMPP installation that I use for testing various configurations. I figured that it was a *nix vs Windoze directory-naming convention after I thought about it for a bit and I can provide a work-around!
Re: ozpost shipping module
Quote:
Originally Posted by
lat9
I figured that it was a *nix vs Windoze directory-naming convention after I thought about it for a bit and I can provide a work-around!
I have no doubts about it. :)
Cheers
Rod
Re: ozpost shipping module
I got ozpost to install (step #1) with the following changes to /includes/modules/shipping/ozpost.php:
Code:
private function _get_cache_folder($folder) {
$cachefolder = DIR_FS_SQL_CACHE. "/ozpost/";
if ($folder == DIR_FS_ADMIN) {
//-bof-20140801-lat9-Drive letter fix
if (preg_match('/^[A-Z]:/i', $folder)) {
$folder = substr ($folder, 3);
}
//-eof-20140801-lat9
$elements = explode("/", $folder);
$cachefolder .= $elements[sizeof($elements) - 2] . "/";
}
return $cachefolder ;
}
private function writeTempFile($folder, $subfolder, $filename, $data) {
$err = false;
$oldperm = $this->_changePerms(DIR_FS_SQL_CACHE) ;
$cachefolder = $this->_get_cache_folder($folder) ;
//-bof-20140801-lat9-Fix for drive letter
if (preg_match('/^[A-Z]:/i', $subfolder)) {
$subfolder = substr ($subfolder, 3);
}
$myFolder = $cachefolder . $subfolder;
//-eof-20140801-lat9
if (!is_dir($myFolder)) {
if (!mkdir($myFolder, 0775, true)) $err = true; }
if (!$err) { // no error, write file
$file = $myFolder . $filename;
if (!(file_put_contents($file, $data))) $err = true; }
if ( isset($oldperm) && ("$oldperm" < "0775")) chmod(DIR_FS_SQL_CACHE , octdec($oldperm)) ;
return $err;
}
The basic idea was to remove the drive letter (and its colon and following forward- or trailing-slash) from a passed folder name if the name starts with a drive-letter followed by a colon.
I've still got a bunch of PHP warnings (all similar to the following) but I'm thinking that they're safe to ignore:
Code:
[02-Aug-2014 03:53:36 Australia/Victoria] PHP Warning: filemtime(): stat failed for C:/xampp/htdocs/zen_new/images/icons/ozpost/ozpost_regi.gif in C:\xampp\htdocs\zen_new\includes\modules\shipping\ozpost.php on line 4473
Re: ozpost shipping module
Quote:
Originally Posted by
lat9
I got ozpost to install (step #1) with the following changes to /includes/modules/shipping/ozpost.php:
Thanks for that. You've saved me a couple of hours work, so in return, if you are running ozpost on a test/demo site please let me know the name of the site for a perpetual free ozpost subscription. (This actually applies to any developer that runs a site w/ozpost for demo purposes only).
If you have done this for a customer/client, again, please advice me of the name of the store for an additional 3 months of ozpost server access.
Quote:
Originally Posted by
lat9
I've still got a bunch of PHP warnings (all similar to the following) but I'm thinking that they're safe to ignore:
Code:
[02-Aug-2014 03:53:36 Australia/Victoria] PHP Warning: filemtime(): stat failed for C:/xampp/htdocs/zen_new/images/icons/ozpost/ozpost_regi.gif in C:\xampp\htdocs\zen_new\includes\modules\shipping\ozpost.php on line 4473
Yes, those are safe to ignore. You should be able to avoid the error messages by setting the 'Icons style' option to 'None'.
FYI, what is happening here is that the later versions of ozpost are no longer packaged with the icons for the carriers or methods. With over 600 of them now possible, and only a fraction of them used by any given installation/configuration these are now being downloaded from the ozpost servers on an 'as needed' basis. They are then stored in the images/icons/ozpost folder for faster access with subsequent requests. If the icons are disabled this part of the code should be skipped.
Cheers, and thanks again for the code update.
RodG
Re: ozpost shipping module
Hi Rod,
Ozpost is offering a 1Kg pack and track option to the USA for an item weighing 3.8Kg
With debugging turned on, the query sent is;
Code:
QueryString
http://svr1.ozpost.net/postage.php?weight=3990&height=95&width=95&length=125&value=84&fromcode=3190&Osub=HIGHETT&destcode=US&flags=&host=Homann+Designs&storecode=3190&version=3.6.0&ef=0&deadline=7&maildays=25&AllSat=1
The server returned;
Code:
<pre>SimpleXMLElement Object
(
[quote] => Array
(
[0] => SimpleXMLElement Object
(
[id] => PATPPS
[cost] => 35.70
[days] => 9
[description] => Pack and Track 1kg Prepaid Satchel
)
[1] => SimpleXMLElement Object
(
[id] => SEA
[cost] => 59.00
[days] => 64
[description] => Sea
)
[2] => SimpleXMLElement Object
(
[id] => SEAi
[cost] => 68.60
[days] => 64
[description] => Insured Sea
)
[3] => SimpleXMLElement Object
(
[id] => AIR
[cost] => 88.30
[days] => 9
[description] => Air
)
[4] => SimpleXMLElement Object
(
[id] => EPI
[cost] => 95.30
[days] => 9
[description] => Express Post International
)
[5] => SimpleXMLElement Object
(
[id] => AIRi
[cost] => 97.90
[days] => 9
[description] => Insured Air
)
[6] => SimpleXMLElement Object
(
[id] => EPIi
[cost] => 104.90
[days] => 9
[description] => Express Post International Insured
)
[7] => SimpleXMLElement Object
(
[id] => EPIP5
[cost] => 111.00
[days] => 5
[description] => Express Post International 5kg Prepaid Box
)
[8] => SimpleXMLElement Object
(
[id] => ECIP5k
[cost] => 134.65
[days] => 5
[description] => Express Courier International 5kg Prepaid Box
)
[9] => SimpleXMLElement Object
(
[id] => ECIm
[cost] => 134.65
[days] => 5
[description] => ECI Merchandise
)
[10] => SimpleXMLElement Object
(
[id] => ECImi
[cost] => 144.25
[days] => 5
[description] => Express Courier International Insured
)
[11] => SimpleXMLElement Object
(
[id] => EPIP10
[cost] => 189.50
[days] => 5
[description] => Express Post International 10kg Prepaid Box
)
[12] => SimpleXMLElement Object
(
[id] => ECIp
[cost] => 195.25
[days] => 2
[description] => ECI Platinum
)
[13] => SimpleXMLElement Object
(
[id] => ECIpi
[cost] => 204.85
[days] => 2
[description] => Express Platinum Insured
)
[14] => SimpleXMLElement Object
(
[id] => ECIP10
[cost] => 211.80
[days] => 5
[description] => Express Courier International 10kg Prepaid Box
)
[15] => SimpleXMLElement Object
(
[id] => EPIP20
[cost] => 346.50
[days] => 5
[description] => Express Post International 20kg Prepaid Box
)
[16] => SimpleXMLElement Object
(
[id] => ECIP20
[cost] => 386.25
[days] => 5
[description] => Express Courier International 20kg Prepaid Box
)
)
[information] => SimpleXMLElement Object
(
[servername] => svr1.ozpost.net
[serverIP] => 199.16.184.178
[serververs] => 11-July-2014
[timestamp] => Mon Aug 11, 2014 10:52 (SA Server Time)
[requesttime] => 11:22 (VIC Store Time)
[postdate] => Thu 14th of Aug
[insurance] => 9.60
[surcharge] => 0.00
[egoinsurance] => 0.00
[stainsurance] => 0.00
[cplinsurance] => 0.00
[skpinsurance] => 0.00
[trdfwinsurance] => 0.00
[trdaeinsurance] => 0.00
[trdtiinsurance] => 0.00
[trdtpinsurance] => 0.00
[trdcpinsurance] => 0.00
[trdmfinsurance] => 0.00
[trdnlinsurance] => 0.00
[registration] => 0.00
[sod] => 2.95
[fromsuburb] => HIGHETT
[destsuburb] => SimpleXMLElement Object
(
[0] =>
)
[zone] => 4
[tnt_response_time] => 0
[fw_response_time] => 0
[trd_response_time] => 0
[ego_response_time] => 0
[cpl1_response_time] => 0
[cpl2_response_time] => 0
[sms_response_time] => 0
[sta_response_time] => 0
[skp_response_time] => 0
[origstate] => VIC
[expires] => 107
)
)
Is this a problem with something I've done? I'm using the latest 3.6.0
Cheers,
Peter
Re: ozpost shipping module
Quote:
Originally Posted by
Peter Homann
Is this a problem with something I've done? I'm using the latest 3.6.0
This was a bug in the server code. Apparently I managed to delete a line of code with in one of the later updates.
All fixed now.
Cheers
RodG
Re: ozpost shipping module
Hi Rod,
Thanks for that.
Cheers,
Peter
Re: ozpost shipping module
Hi,
I finally decided to update ozpost and pay the subscription but before I do that I want to test out on local server site before touching my live version. All was good with it until I changed suggested files for ozpost upgrade and then it disappeared from my Admin/modules/shipping. I have tried deleting and re-copying files, searched forum for solution all with no luck. Currently stuck with cache error "[29-Aug-2014 13:09:54] PHP Fatal error: Call to undefined function curl_init() in C:\Zen\xampp\htdocs\aescrap\includes\modules\shipping\ozpost.php on line 2989".
I am using zen v1.3.9h and of course the latest version of ozpost v3.6.0. Can you please advise what files I need to remove in order to then try a fresh install of ozpost as per the readme instructions...or is there some other solution to this problem of the module not showing up in admin anymore. Thanks Cheryl.