Jump to content

Code to Calculate UPS Shipping...


Guest

Recommended Posts

Hi All,

Here is the base code to put on the view_product page or ont he checkout page itself. I did start working on this but haven't finished yet. I'm working on adding estimated shipping directly to the view_cart.php page..

The code below will require the total weight and the customers zip code.. All that is needed is a small text box for the zip..

Here is the code:

<script><!--

function showshipping(){

var quant=document.ordform.vwquantity0.value

if(quant==""){alert("Please enter Quantity");return false}

if(isNaN(quant)){alert("Please enter valid Quantity");return false}

var zip=document.shippingf.zip.value

if(zip==""){alert("Please enter your Postal Code");return false}

if(isNaN(zip)){alert("Please enter valid Postal Code");return false}

var origzip="11111"

var weight=1*quant;var value=6.49*quant;window.open("http://www.ups.com/using/services/rave/qcosthtm.cgi?accept_UPS_license_agreement=yes&nonUPS_title=UPS%20Quick%20Cost%20Calculator&nonUPS_body=&nonUPS_footer=&nonUPS_header=%3CSCRIPT%20LANGUAGE%3D%22JavaScript%22%20TYPE%3D%22text%2Fjavascript%22%3E%20var%20pgf_Site%3D%22Country%22%20%3C%2FSCRIPT%3E%3CSCRIPT%20LANGUAGE%3D%22JavaScript%22%20SRC%3D%22%2Fjavascript%2Fglobal.js%22%20TYPE%3D%22text%2Fjavascript%22%3E%3C%2FSCRIPT%3E&10_action=4&14_origCountry=US&15_origPostal="+origzip+"&48_container=00&47_rate_chart=Regular%20Daily%20Pickup&49_residential=0&weight_std=LBS&22_destCountry=US&19_destPostal="+zip+"&23_weight="+weight+"&24_value="+value,"","width=600,height=400,resizable=1,scrollbars=yes")

}

//--></script>




The code for the page to input the zip.. 




<a href="javascript:void(0)" onClick="showshipping()" onMouseOver="window.status='Calculate Shipping Cost';return true" onMouseOut="window.status=''"><img src="images/calcship.gif" width="100" height="29" alt="Shipping cost" border="0" hspace="5"></a><br>

I'll make an update when I get to this.

Chris

Link to comment
Share on other sites

I'm new :errm: obviously.

I looked at integrating a live UPS shipping mod and realized quickly it was beyond my skills.

One option I am considering, though a bit old fashioned, is to use the zoned shipping charts as provided by UPS. They are based on weight and proximity and luckily are in .csv form. My thinking was to create tables for each zone. By reading the zip code from the delivery address and doing a weight calculation it would be possible to get the shipping pretty exact for all shipping options.(ground,2nd day,etc.). The advantage would be that only normal database reads would be required and it could be easily "adjusted" with a multiplier. The disadvantage would be setting it up and periodically updating it.

Really, I was just wondering if this idea makes any sense. Any thoughts appreciated.

Link to comment
Share on other sites

Hello,

I just recently signed up with UPS so I have all of the pricing in the national shipping book or whatever comes in the welcome package. As it shows in the code above, no calculations need to take place within cubecart really.. You just need to be able to add the weight to each product and then calculate the total weight and send that along with the zip code of the warehouse to get estimated pricing.

I had started on this but then stopped as I too don't know much about shipping procedures either.. Not in regards to programming it or adding it to shopping carts but that is my next step as I have to have this working in my own cart as well..

I'll look into this and see what I can do.. Maybe Brooky has some ideas on this?

Regards,

Chris

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...