dish_x Posted July 8, 2011 Share Posted July 8, 2011 Hi everyone,I'm attempting to implement a shipping calculator into my website (www.oz-audio.com.au) however it seems to be a lot more complicated than I thought.Here's some info the shipping company sent to me regarding the API: Call Method:Requests are passed to Transdirect via HTTP GET method, essentially via the URL. The URL to passthe variables to is http://www.SHIPPINGCOMPANY.com.au/calculator/return_quote.phpThe variables are:from - Numeric, 4 digits The postcode of the pickup locationto - Numeric, 4 digits The postcode of the delivery locationlength - Numeric, 1-3 digits The length of the item, in cmwidth - Numeric, 1-3 digits The width of the item, in cmheight - Numeric, 1-3 digits The height of the item, in cmweight - Numeric, 1-3 digits The weight of the item, in kgquantity - Numeric, 1-3 digits The quantity of this item.id - Numeric, 1-5 digits Membership ID numberExample:If we were shipping from postcode 3000 to postcode 4000 and had two items:first item is 7 x 12 x 15cm, 35kgssecond item is 22 x 15 x 10, 27kgswww.SHIPPINGCOMPANY.com.au/calculator/return_quote.php?from=3000&to=4000&quantity;[]=1&length;[]=7&width;[]=12&height;[]=15&weight;[]=35&quantity;[]=1&length;[]=22&width;[]=15&height;[]= 10&weight;[]=27&member=40 Now there are a few things I would need to do in order to achieve this correctly..Firstly I would need to assign dimension values to the products, and the easiest way to go about this is to use standard dimensions for each category (For eg: all the products in 'Head Units' category would have 30cmx30cmx40cm)I was then thinking I would need to create a function (or modify an existing function) in site/classes/Carrier.phpWould it be possible to modify the function 'getDeliveryPriceByWeight' or create a new one that would execute the following commands whenever a shipping estimate is called for 1. Declare 'shippingString' as String = "http://www.SHIPPINGCOMPANY.com.au/calculator/return_quote.php?from=3000&to;=" + Get current logged in customer post code 2. Check if there is products in the cart If true, then loop this for each product in cart: 2a. Declare length, height, width, quantity as string 2b. Determine product box dimensions based on category (get product category id, if category id = "Head Units" then length = 30, height = 30 and width = 40) and quantity = quantity in current cart 2c. shippingString = shippingString + "&quantity;[]=" + quantity + "&length;[]=" + length + "&width;[]=" + width + "&height;[]=" + height + "&weight;[]=" 3. After all products in cart have been looped through, append the shippingString: shippingString = shippingString + "&member=40" 4. Execute an HTML GET with the data in shippingString 5. Display the result (should either be a numeric value, or an error message) Apologies for the crappy pseudo-code but hopefully that explains what I would like to achieveCurrently running Prestashop 1.3.3If anyone could help or has relevant experience/advice I would greatly appreciate itThank YouDish Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now