Closed (duplicate)
Project:
Commerce UPS
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
16 Mar 2012 at 19:31 UTC
Updated:
24 Nov 2015 at 19:21 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
andrew m riley commentedI need to do a very similar thing for one of my sites. I've been holding off on implementing the change until the entity as a field in the Address module has been completed.
The way I see it working is:
1) It would be a separate module
2) Admins could add a ship from address to the product
3) The new module would send the aplicable addresses to the shipping module and the shipping module would send out the requests. Add up the amounts etc.
The issues I think we'll face:
1) Most shipping modules try to send off the request to the API in one request. The shipping modules would have to be slightly modified to allow for more than one address.
Overall I think its a great idea and very needed!
Comment #2
chrisjlee commentedAs per discussion with ryan today at drupalcon, the best possible solution at the moment would be to add a hook to alter shipping.
The discussion indicated that a hook was pertinent and necessary to be included as the UI layer can be added later. As that is best pratice.
I've attached a patch to attempt to do this. Looking forward to your review.
Comment #3
chrisjlee commentedsorry wrong file - let's try again
Comment #4
chrisjlee commentedone last time then bed. Added api file and attempted to document the hook
Comment #5
chrisjlee commentedarg. practice makes perfect i guess. working at getting better at patching. changed an embarrasing error
Comment #6
andrew m riley commentedOverall, this is possible (we would need to significantly work on how the module queries data and most likely split the current method out to a child module) but I do have a question about the other shipping methods.
1) Do the other shipping methods require other fields than ship from, ship to, weight and size?
2) This module does a rough box count approximation how would this work for things like UPS Freight?
3) Do the other services have additional costs like UPS standard does to deliver to residential addresses?
Comment #7
rtdean93 commentedThanks Andrew...
For our use case - we just need to have two instances of the fields currently employed by the admin form. So no new fields are needed.
To answer your questions specifically,
1) no
2) We are not using UPS Freight, so the approximate is fine.
3) Right now, we are using the same services as the existing module.
The fields important to have two options...
Ship From Address
UPS Account Number
UPS Password
UPS Key
Thanks Chris and Ryan for your help also.
Comment #8
chrisjlee commentedI misunderstood bobby's requirements the hook should actually placed in right in the function where the shipping services call is being made and then an xml file is generated.
This is actually what ryan was talking about. I had added a hook in the wrong function.
Thus, i've rerolled the patch.
Comment #9
andrew m riley commentedWhoops, I mixed up two issues. Don't mind the freight comments.
Comment #10
andyg5000Would it be better to use drupal_alter to allow other modules to alter the request? If so, here's a patch.
Comment #11
andyg5000Here's an updated patch that includes the order object so that you can actually do something with the rate request :)
I've also included the commerce_ups.api.php.
Comment #12
bendiy commentedI'm adding a hook over here #2293431: Abstract Ship To and Ship From addresses with hook_..._alter() that will let you modify the Ship From address based on the order.
Comment #13
bellagio commentedcomment deleted
Comment #14
ultimikeComment #15
andyg5000Let's push this further in the RTBC #2362527: Allow other modules to interact with commerce_ups