News:

Support the VirtueMart project and become a member

Main Menu

DHL Shipping and printing shipping labels

Started by durian, January 04, 2006, 18:10:59 PM

Previous topic - Next topic

fidel

Is there a final version with all the fixes that you can post here. Thanks.

durian

Fidel,
There have been no code changes.  Until a VirtueMart maintainer integrates DHL into the main code
branch, use the tar ball from here:
http://virtuemart.net/index.php?option=com_smf&Itemid=71&topic=14307.msg29600#msg29600

The only exception is to use the DHL API sign-up form included in this posting:
http://virtuemart.net/index.php?option=com_smf&Itemid=71&topic=14307.msg29836#msg29836

mike

durian

I just encountered a case where a tracking XML response did not included a field I had assumed was mandatory. The result was an empty tracking window.  This change fixes that problem.  I'm attaching both a dhl.php drop-in replacement as well as a diff so you can see what has changed.

mike

[attachment cleanup by admin]

Phillip Wheat

durian, thanks for the hard work and for sharing this DHL module.

I did the manual install and have an issue you may can help with.

I know the module is being called at order processing because I can see the "It's too late to ship today" type message.

But I do not see any shipping options below that message at order processing.

I do have an "official" DHL key, userid and password.

I am in Test Mode.

Any suggestions?

Do you offer consulting services to fix this kind of thing?

durian

Sorry, I don't have the time to do consulting, but here are some things you should look into.
First, make sure you have the various DHL shipping methods enabled.  For example, dhl.cfg.php should contain some lines like:

define ('DHL_EXPRESS_ENABLED', 'TRUE');
define ('DHL_NEXT_AFTERNOON_ENABLED', 'TRUE');
define ('DHL_SECOND_DAY_ENABLED', 'TRUE');
define ('DHL_GROUND_ENABLED', 'TRUE');
define ('DHL_1030_ENABLED', 'TRUE');
define ('DHL_SATURDAY_ENABLED', 'TRUE');
define ('DHL_INTERNATIONAL_ENABLED', 'TRUE');

If those values aren't TRUE, then they won't be presented as shipping options.

The next thing to do is check the XML requests and responses.  In dhl.php, around line 386, you will see,

                        $recv->appendChild($addr);
                        $shipment->appendChild($recv);
                        $root->appendChild($shipment);

//                      $vmLogger->err($xmlReq->toNormalizedString());

                        if (function_exists( "curl_init" )) {


Uncomment the debug line by removing the // from the $vmLogger line.  Do the same thing for the following code around line 419:

                                    '</span>';
                                continue;
                        }
//                      $vmLogger->err($xmlResp->toNormalizedString());

                        // Check for success or failure.
                        $result_code_list =& $xmlResp->getElementsByPath('//Result/Code');


By uncommenting those lines, you will be able to view the XML requests and responses, they might help in diagnosing the problem.

mike

Phillip Wheat

I understand the time thing!   Thanks for the help.


durian

They will appear on the screen, though you might need to adjust the PHP configuration to display errors.
You enable this in php.ini (on my FreeBSD box, it is /usr/local/etc/php/php.ini). Set display_errors to On, ala:

display_errors = On


If your PHP is configured to display errors, then it is possible the rate listing function is returning before it even makes it to the debug lines.  For instance, line 112 of dhl.php checks the shipment weight. If the weight is 0, it returns without doing anything (if the weight is 0, then you don't really have anything to ship):

                if ($d['weight'] == 0)
                        return (true);

You can change that to

                if ($d['weight'] == 0) {
                        $vmLogger->err("Shipment has no weight");
                        return (true);
                }

to see if you are encountering that case.

I think that is the only return prior to displaying the XML request, but you should double-check as I only did a quick look through the code.

mike

Phillip Wheat

Mike, thanks for your response and begging your indulgence.
I did find that the user_info_id field seems to be the culprit, but have been back through the mods and can't find how I missed this one.

FYI running Joomla 1.08 and current stable Virtuemart version VirtueMart 1.0.5 stable 


Here's the debug copy.  Any help appreciated.  You need a donation link!

Debug: Starting Shipping module: dhl



Notice: Unknown column 'user_info_id' in 'where clause' in /home/virtual/site94/fst/var/www/html/includes/database.php on line 282

/home/virtual/site94/fst/var/www/html/includes/database.php:473
/home/virtual/site94/fst/var/www/html/administrator/components/com_virtuemart/classes/ps_database.php:101
/home/virtual/site94/fst/var/www/html/administrator/components/com_virtuemart/classes/shipping/dhl.php:102
/home/virtual/site94/fst/var/www/html/administrator/components/com_virtuemart/html/checkout.index.php:175
/home/virtual/site94/fst/var/www/html/components/com_virtuemart/virtuemart.php:217
/home/virtual/site94/fst/var/www/html/components/com_virtuemart/virtuemart.php:262
/home/virtual/site94/fst/var/www/html/index.php:210

durian

I'm not sure I can help you with this one.  You are running new versions of VirtueMart and Joomla than I am.  Apparently a change was made in VirtueMart affecting the user_info_id field.  Can a VirtueMart commiter comment?

Speaking of which, I released the DHL quite a few VirtueMart revisions ago.  Perhaps it is time for a VirtueMart commiter to finally integrate this code officially so it will stay synced with changes.

mike

Phillip Wheat

I wholeheartedly agree that the DHL module needs attention.

Don't make me go back to oscommerce!!!!!

Phillip Wheat

Miracle of miracles .... DHL module is now working.....

durian

That's good news.  Can you provide details on how you fixed things, in case others run into the same problem?

mike

BruceW

#42
Mike,
Very good work.  Thank you so much for doing this.

[snip]
Quote from: durian on February 22, 2006, 20:18:32 PM
patch(1) is the patch program.  (1) is unix syntax for "manual section 1" - as in "man 1 patch" will
explain the usage of the patch program.  Manual section 1 contains the commands that make up
the unix user environment.

mike

I have a question on the patches.  I am familiar with using them but I am finding some anomolies in the patch.
First, here is the process I used to patch, it tells me:

# patch <order.order_list.php.patch
patching file order.order_list.php
Reversed (or previously applied) patch detected!  Assume -R? [n] n
Apply anyway? [n] y
Hunk #1 FAILED at 16.
Hunk #2 FAILED at 90.
Hunk #3 FAILED at 102.
Hunk #4 FAILED at 121.
4 out of 4 hunks FAILED -- saving rejects to file order.order_list.php.rej


Now, it seems that the file had already been patched when I installed it?  Is this true?
I even stepped up the fuzz factor to no avail.
I find that some of the patches are already there in the .orig file.

Also, this section keeps repeating itself like 3-4 times. Is that supposed to the be the case?

@@ -115,7 +121,91 @@
        $url = $_SERVER['PHP_SELF']."?page=$modulename.order_print&limitstart=$limitstart&$
        $tmp_cell = "<a href=\"" . $sess->url($url) . "\">".sprintf("%08d", $db->f("order_$
        $listObj->addCell( $tmp_cell );
-
+
+       // Look in #__{vm}_shipping_label for this order and extract the
+       // shipping class name.  Then check to see if the shipping module
+       // supports generating shipping labels.  If so, add a print icon
+       // button for printing the label, otherwise leave the column empty.
+       $lq = "SELECT shipper_class, label_is_generated ";


Can't figure out why without the original, original file.  I am prolly too stoopid  ???
Please advise.
Thanx again.
Bruce

durian

Regarding the previously applied patch - I don't know.  I am not running the latest VM code myself (the
updates are a bit too frequent), but I doubt they applied the order_list patch with integrating the DHL.
More likely, you already applied that patch without realizing it.

If you are seeing code section from one of my patch appear multiple times, then you are probably
applying the same patch multiple times without realizing it.  At this point, maybe you want to start
from a clean slate and try again.  Overwrite the modified files with unpatched ones and try again.
Looking for files that end in .orig will help you figure out what files have been modified.

Perhaps it is time someone who wants to use the DHL shipping module open a VM bug report requesting
these changes be integrated into the stock VM code.  I had hoped a VM commiter would have done
this on their own by now, but maybe they are waiting for an official request in the form of a PR.

mike

Soeren

Hello,

no - this is already implemented in the VirtueMart CVS code. The 1.0.x branch is a maintenance branch, so all updates and new features go into the 1.1.x branch (CVS HEAD).

ciao, Soeren
The future of eCommerce: VirtueMart & Joomla!
http://virtuemart.net