I created an empty ozpost.php file in /includes/languages/english/modules/shipping/ (the / vs \ path symbolism is simply a case of me pasting the text as is)
The first errors have gone but still getting this error:
in admin> modules >shipping
Warning: Missing argument 4 for template_func::get_template_dir(), called in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\zc1\includes\modules\shipping\ozpost.php on line 67 and defined in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\zc1\includes\classes\template_func.php on line 42
Warning: Missing argument 4 for template_func::get_template_dir(), called in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\zc1\includes\modules\shipping\ozpost.php on line 69 and defined in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\zc1\includes\classes\template_func.php on line 42
Warning: Missing argument 4 for template_func::get_template_dir(), called in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\zc1\includes\modules\shipping\ozpost.php on line 70 and defined in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\zc1\includes\classes\template_func.php on line 42
Warning: Missing argument 4 for template_func::get_template_dir(), called in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\zc1\includes\modules\shipping\ozpost.php on line 97 and defined in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\zc1\includes\classes\template_func.php on line 42
Warning: Missing argument 4 for template_func::get_template_dir(), called in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\zc1\includes\modules\shipping\ozpost.php on line 97 and defined in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\zc1\includes\classes\template_func.php on line 42
Warning: Missing argument 4 for template_func::get_template_dir(), called in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\zc1\includes\modules\shipping\ozpost.php on line 97 and defined in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\zc1\includes\classes\template_func.php on line 42
These last lines are repeated many times.
Thats a serious beard you've got going there by the way !
Thanks
Last edited by remoteone; 29 Mar 2009 at 07:27 AM.
Hello,
I created a blank ozpost.php in the appropriate location (/var/www/includes/languages/english/modules/shipping/ozpost.php) and that solved the first one.
Next is the parameter problem "Missing argument 4 for template_func::get_template_dir()"
The method is declared in template_func.php as:
function get_template_dir($template_code, $current_template, $current_page, $template_dir, $debug=false)
But is being called in ozpost.php as
$template->get_template_dir('ozpost_del.jpg', $ipath,$ipath2)
Your old AustPost module makes the call with 4 params.. How is get_template_dir declared in your version of Zen Cart? (I have the latest version installed 1.3.8a).. If I add a default blank parameter it's happy, but that might be masking something else..
Anyway, with those fixes it seems to install correctly and works :-)
A Registered International Parcel option would be awesome (now available for parcels up to 2 kg)
Thanks for your effort in supplying this,
David
Great. I do believe we are getting somewhere :-)
Unless I'm mistaken the 'missing parameter' is supposed to be supplied by the $ipath variable. IOW, $ipath is supposed to expand to
"value1, $value2" (without the quotes), but it appears it is being seen as a single value (same data, but with quotes).
I'm not sure why it is working correctly on my system(s), perhaps it is due to a subtle difference between Linux and Windows?
As for the Registered International parcels, I'd swear blind that I'd catered for that. I guess this also warrants further investigation. On the plus side, even if it hasn't been catered for, the way this version is designed it is actually quite a trivial task to add new methods, so this WILL be supported (or fixed) in the very near future.
Quick question, where did you add the blank parameter in order to get it working? (between the two $ipaths? before them? or after them?)
Trying to save myself a little work :-)
Cheers
Rod
Hi,
I made the modification to /var/www/includes/classes/template_func.php purely to see if everything else worked correctly by hiding that 4th param error.
Changed
function get_template_dir($template_code, $current_template, $current_page, $template_dir, $debug=false)
to
function get_template_dir($template_code, $current_template, $current_page, $template_dir = '', $debug=false)
I'm not a PHP coder (only started looking through it yesterday), and all this dynamic typing scares me a little compared to strongly typed lanugages which I'm used to. It seems much harder to tell what you are dealing with when you have a variable i.e. I have to look up to try and find what was assigned to it.. anyway, I'm getting side tracked about PHP!
I'm interested in what you mention about $ipath expanding, is that a feature of PHP where a variable can expand to fill more than one parameter? What type does the variable have to be?
By the way, I have the latest version of PHP5 installed (or very close to).
David
I'd strongly advise against changing that particular file (other than for debugging purposes). The reason being is that is one of the core zencart files and it can possibly cause lots of unforeseen problems because lots of modules, perhaps all them them will be dependent on it.
It also means it'll need to be repatched any time zencart gets an upgrade.
I could argue that if you are used to strongly typed lanquages, the PHP should be a PoP (piece of pxss) <grin>
LOL.
Actually, 'expanding' was probably a poor choice of words, and not really correct.
Suppose we needed to pass two parameters to a function, we would typically use something like:
thisfunction(valueA, valueB)
Or in a strongly typed language
thisfunction(int integerA, string stringA)
What I have done (trying to avoid retyping the same thing in several different places) is to create a 3rd variable called $ipath (for IconPath)
that concats the two paramters to be passed to the function. In other words, using the examples above
$ipath = valueA + "," + valueB
or, strongly typed, it would be:
$ipath = "int " + integerA + "," + "string" + stringA
So now when I call the function, instead of
thisfunction(int integerA, string stringA) I am simply using
thisfunction($ipath)
In *most* cases/programs this technique would be useless/pointless, but since the icon path never changes during the programs execution it seemed like a practical thing to do.
When I said 'expansion' I was implying that the function being called wouldn't be seeing "$ipath" as a single parameter, it would be recieving it as two separate values ie, valueA, comma, valueB.
This clearly works on my system(s), but for some reason or another it isn't working on yours and at least two others (all windows based)
I think I'll take the 'safe' way in fixing this one and pass the parameters in the more traditional manner rather than saving a few bytes of typing (which has now been 'wasted' in trying to sort out what the heck has gone wrong).
Live and learn. (and frustate a few people in the process).
Cheers, and thanks heaps for all the debugging. I'll try to get an updated release out in the next few days, after I've figured out what the heck happened to the registered overseas parcels.
Rod
Hi Rod,
I'd agree, I only changed it for debugging purposes (live server will be a fresh install when I've worked out all my mods etc :-))
Thanks for the other info. You can't construct a string representing the combined parameters as they'd look at compile time and pass it at runtime in C++, Java etc. (as I'm sure you know :)).. however PHP seems to be a complete free for all.. ! hehe ;-)
Let me know if I can do anything to help,
Thanks!
David
I do, just as I'm sure you know by now that unlike C++, Java, etc, which are compiled, PHP is little more than a script.
I'm never really sure if this is a blessing or a curse. As you say, it makes it a free for all, which makes it a pretty easy language to learn, but it also allows the ability to create lots of buggy code that simply couldn't exist in a strictly typed language.
Mind you, PHP isn't the worst in this regard. Have you ever looked into Pyhon? It is the only language that I know where you can do something like:
variable = "Hello World"
print variable * 2
and it will dutifully print out "Hello World Hello World".
Now THAT's a free for all, but even odder is that Python is actually compiled and still allows this.
Cheers
Rod. (heading off to bed)
I should be in bed also,
Looks like you've got a bit of work to do there Rod...
I'm gonna wait 'till the ozpost module is all figured out... as if any module is ever "all figured out".. this is free-open-source
Thanks for your efforts ...
Bookmarks