Welcome, Guest. Please login or register.
Login with username, password and session length


It's a release candidate! VirtueMart 2.0 RC - the next generation VirtueMart - is available! Read more....

  Advanced search

247038 Posts in 67506 Topics- by 258314 Members - Latest Member: aniketana
Pages: [1] 2 3   Go Down
Print
Author Topic: Shipping Calculator and Free Shipping Above Set Price  (Read 27377 times)
Drake
Newbie
*
Posts: 36



WWW
« on: October 03, 2007, 03:10:59 AM »

*****Last Update 11-02-07******

***Fixed Error that is received when order is over 70lbs.***

This Mod will work on VM 1.012+ We needed Free Shipping above $150 on our site. This was very easy to add in the ups.php file. However my boss also wanted a Shipping Calculator in the cart so customers wouldn't have to go all the way through the checkout process to find out the cost of shipping. A number of files had to be modified. This Shipping Module can function as the original UPS 1.2 without Free Shipping or the Shipping Calculator just by changing the settings in the UPS shipping module configuration. Admin > Virtuemart > Store > Shipping Module List. Anyone wanting to try this please leave feedback or suggestions. I want to get all the bugs out so maybe it will be included in future versions of Virtuemart. I will include more detail on were to change color for the tables in my next post.

To test this out go to the link below. Remember this is a live site so don't buy anything unless you want it.
http://www.ballewsawandtool.com

Add a product to the cart and you will be shown the amount needed to get free shipping. If the item added is above $150 it will show up as free shipping. When a zip code is entered it will show the UPS shipping prices.

Files that were modified:

basket_b2b.html.php
basket_b2c.html.php
basket.php
checkout.index.php
ps_cart.php
shop.cart.php
ups.cfg.php
ups.ini
ups.php

Remember to back up files first!

* UPS Shipping Calculator 11-02-07.zip (32.75 KB - downloaded 717 times.)
« Last Edit: November 02, 2007, 00:49:05 AM by Drake » Logged

Drake
Newbie
*
Posts: 36



WWW
« Reply #1 on: October 03, 2007, 15:09:09 PM »

This image show the Shipping Calculator and Amount Needed to get Free Shipping




If the customer has more than the amount needed to get free shipping UPS Ground is free

Logged

Drake
Newbie
*
Posts: 36



WWW
« Reply #2 on: October 10, 2007, 01:37:16 AM »

If you downloaded the UPS Calculator before 10/10/2007 you will need to download the file below. The Original zip was missing the shop.cart.php file. IT has been corrected now so all new downloaders get the zip on the first post.

Thanks

* shop.cart.php.zip (2.14 KB - downloaded 455 times.)
Logged

laurie_lewis
Full Member
***
Posts: 211


« Reply #3 on: October 10, 2007, 05:04:18 AM »

Hi Drake,

without looking too far into this - will it work with other shipping modules or only with UPS?

Thanks

Logged

Drake
Newbie
*
Posts: 36



WWW
« Reply #4 on: October 15, 2007, 04:07:59 AM »

The way it is set up just UPS. I could be altered to work with different modules though. Which one do you have in mind?
Logged

Drake
Newbie
*
Posts: 36



WWW
« Reply #5 on: October 19, 2007, 16:45:25 PM »

I just updated the plug-in to allow free shipping to lower 48 states only. It can be downloaded in my first post. This is an option that can be removed in the configuration. Also the background and text for the Shipping Calculator/Free Shipping can be set in the configuration. I would like to expand this to work for other countries so if anyone can help me or give input on how shipping by UPS works in your country it would really help
Logged

aravot
Peter
Quality&Testing Team
Hero Member
*
Posts: 2921


WWW
« Reply #6 on: October 19, 2007, 20:04:06 PM »

Can you code for VM 1.1 version?
Logged

laurie_lewis
Full Member
***
Posts: 211


« Reply #7 on: October 22, 2007, 19:14:02 PM »

Hi Drake,

I was interested in if it could be adapted (shipping calculator only) for the standard shipping module. 

Thanks

Logged

Drake
Newbie
*
Posts: 36



WWW
« Reply #8 on: October 23, 2007, 00:29:01 AM »

I'll try to code for VM 1.1 in the next couple of weeks. I'll also look into what it will take to make it work with the standard module.
Logged

Dale
Newbie
*
Posts: 2


« Reply #9 on: November 01, 2007, 23:54:10 PM »

Drake,

Has your customer complianed yet about the fact that no one can place a very large order weight wise?
I have a client that sells similar products and the ups module seems to error out at 70 pounds by default and 150 at the max with tweaking.

Like for your client try ordering this:
Systimatic 8MC60-085G      SKU# SYS-37280   try ordering 15 of these sawblades.

It blows the cart and doesnt give the customer an acceptable resolution and no error message.

Any ideas how to get around this?

 
Logged
Drake
Newbie
*
Posts: 36



WWW
« Reply #10 on: November 02, 2007, 01:10:22 AM »

Dale,

Thank you for pointing out this error. After checking around it turns out this happens a lot with the default UPS module. What happens is UPS sends a warning back notifying the customer that the shipment is over 70 pounds. In return this throws the array out of order. In order to get around this I created an if statement to check if the order is over 70 pounds. If it is then it gives the variable $over70 a value of 1 which is added to the number in the array elements. If the order is under 70 lbs then $over70 is equal to 0. Then zero is added to the array elements which doesn't increase anything so it acts normal. I already fixed the calculator and uploaded it. If you have an older version of the calculator just download the new Shipping Calculator and replace your UPS.php file with the new one.

Around line 304 Replace:
Code:
// Loop through the rate List
for ($i = 0; $i < $rate_list->getLength(); $i++) {

With this:
Code:
// Loop through the rate List
if($order_weight >= 70){ $over70 = 1; } else{ $over70 = 0;}
for ($i = 0; $i < $rate_list->getLength(); $i++) {

Then make your if statement look like this:
Code:

if ( in_array($currNode->childNodes[0]->getText(),$myservicecodes) )  {
// Test for any shipper warnings first!
// if warning is present, we must use a different childNode numbering
$test_warning = $currNode->childNodes[1]->getText();
if( stristr( $test_warning, "LBS" ) || stristr( $test_warning, "KGS" )) {
// Second Element: BillingWeight
$shipment[$i]["BillingWeight"] = $test_warning;
$warning = 0;
}
else {
$shipment[$i]["RatedShipmentWarning"] = $currNode->childNodes[1]->getText();
$warning = 1;
}
// First Element: Service Code
$shipment[$i]["ServiceCode"] = $currNode->childNodes[0]->getText();

if ($warning == 1) {
// Second Element: BillingWeight
$shipment[$i]["BillingWeight"] = $currNode->childNodes[(2+$over70)];

// Third Element: TransportationCharges
$shipment[$i]["TransportationCharges"] = $currNode->childNodes[(3+$over70)];
$shipment[$i]["TransportationCharges"] = $shipment[$i]["TransportationCharges"]->getElementsByTagName("MonetaryValue");
$shipment[$i]["TransportationCharges"] = $shipment[$i]["TransportationCharges"]->item(0);
$shipment[$i]["TransportationCharges"] = $shipment[$i]["TransportationCharges"]->getText();

// Fourth Element: ServiceOptionsCharges
$shipment[$i]["ServiceOptionsCharges"] = $currNode->childNodes[(4+$over70)];

// Fifth Element: TotalCharges
$shipment[$i]["TotalCharges"] = $currNode->childNodes[(5+$over70)];

// Sixth Element: GuarenteedDaysToDelivery
$shipment[$i]["GuaranteedDaysToDelivery"] = $currNode->childNodes[(6+$over70)]->getText();

// Seventh Element: ScheduledDeliveryTime
$shipment[$i]["ScheduledDeliveryTime"] = $currNode->childNodes[(7+$over70)]->getText();

// Eighth Element: RatedPackage
$shipment[$i]["RatedPackage"] = $currNode->childNodes[(8+$over70)];
}

****You do not need to modify any code. The above was just showing what needed to be changed.****
Logged

Josh
Newbie
*
Posts: 30


« Reply #11 on: November 10, 2007, 22:26:06 PM »

Is there any what that the customer can select free shipping on next day?
Logged
Drake
Newbie
*
Posts: 36



WWW
« Reply #12 on: November 11, 2007, 01:56:44 AM »

You could add an elseif statement in the ups.php file. I will try to add specifics if you need me to. Most of the time Red Label (Next Day) is so expensive it wouldn't be profitable. Then most people would just select next day if it was free. I will post the code to alter this if you need me to.
Logged

Josh
Newbie
*
Posts: 30


« Reply #13 on: November 12, 2007, 10:16:43 AM »

I do not need to to be free for next day shipping. The company is really needing something for their customers to be able to select free shipping, and select other types of shipping for a price that UPS gives them.
Logged
Josh
Newbie
*
Posts: 30


« Reply #14 on: December 13, 2007, 09:35:18 AM »

Just checking to see if there is an update to the UPS free shipping to where customers can select free shipping, next day, 3 day etc.

Thanks in advance.
Logged
Pages: [1] 2 3   Go Up
Print
Jump to: