I'm working on a DHL shipping module. I've got the shipping rate estimates pretty much working (one
outstanding question regarding international shipments), but would like to extend things a bit.
The DHL XML API also provides a mechanism for printing shipping labels. I thought it might be useful
to implement that too, but I think I'm going to need an extra database table to do it properly and
databases just aren't my thing.
In order to properly print a label, I need to record some information about the shipping rate selected
by the customer. This way I'll be able to correctly print a label that matches the shipping estimate,
even if some configuration values change. In particular, I need to track shipping method, special services,
duty rate, insurance rate, domestic/international (I could recompute this, but if I'm recording the other
information I might as well record this too). The actual address I can pull out of _order_user_info.
I had initially though to stick this information into shipping_rate_id, but that's not persistant, is it?
Then I've got to figure out what to do with the label image that comes back from DHL. Again, I think
I'll need to stick this in a database so it can be view and reprinted later if necessary. I'll also need to
store the waybill number along with the image so the label can be voided.
So those are my database issues. If anyone can provide any advice on how to set up the table and
populate it, I'd be much appreciative. I think it would need to be done through some script so any
other VirtueMart user's wanting to use the DHL module could easily integrate it into their system.
Even better would be an "official" new database table for this sort of thing, as I wouldn't be surprised
if other shipping methods can be expanded to print shipping labels.
Then there are the user interface issues. I think I'll need to add Print Label and Void Label actions
to the orderinformation screen. I can probably muddle through this, but advice might help.
The last step will involve getting the image into a pop-up window so the browser can print it. Like
my database skills, my HTML skills are lacking. I do think the image data needs to be inlined somehow.
Or failing that, there needs to be a way to detect when the user is done viewing/printing the label
so the temporary file containing the image can be removed - even if the user's browser closes accidentally.
We don't want any image files slowly eating up disk space. Inline data seems like the best bet to me,
but as I said, I don't really know the ins-and-outs of this type of HTML.