Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / Free Shipping - some items - some zones - need upgrades

Free Shipping - some items - some zones - need upgrades

Views: 3,038

Results 1 to 20 of 25
10 Aug 2011, 9:12 PM
#1
djdavedawson avatar

djdavedawson

Zen Follower

Join Date:
Jul 2005
Location:
Orlando, Fl
Posts:
343
Plugin Contributions:
0

Free Shipping - some items - some zones - need upgrades

I have a few items on my site i'd like to offer free Ground shipping to the Inter-Contenental US.

I have set up a zone definition "ICUS" with the 48 zones I will ship these items free to.

I enabled freeshipper and set the zone to "ICUS".

This seems to work except for a few issues.

Issue 1 -> When someone outside the zone ie. Alaska Hawaii, try to buy the item, no shipping options display at all. It just says nothing is available.

Issue 2 -> I would like for there to be Shipping Upgrades available versus the free Ground Shipping.

I have tried a few different things and cant seem to get it configured to work.

Is there someway to do this ?

Thanks in Advance

~D

10 Aug 2011, 11:04 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Free Shipping - some items - some zones - need upgrades

FREE SHIPPING! freeshipper is designed for ALL customers regardless of Zone ...

The Zone setting is there from developers for easier customization of the code ...

How are you marking the Products for Free Shipping to the Zone you want to have Free Shipping?

What other shipping modules are you using?

10 Aug 2011, 11:53 PM
#3
djdavedawson avatar

djdavedawson

Zen Follower

Join Date:
Jul 2005
Location:
Orlando, Fl
Posts:
343
Plugin Contributions:
0

Re: Free Shipping - some items - some zones - need upgrades

I am only using the ups shipping module.

I am marking the products by changing them to "yes, always free shipping" in edit products.

Thanks

~D

11 Aug 2011, 2:08 AM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Free Shipping - some items - some zones - need upgrades

See if post #11 from this thread:
http://www.zen-cart.com/forum/showthread.php?t=176822&highlight=free_shipping_weight

helps you in this customization ...

NOTE: where it references USPS you should customize UPS shipping module in a similar manner ...

11 Aug 2011, 3:01 AM
#5
djdavedawson avatar

djdavedawson

Zen Follower

Join Date:
Jul 2005
Location:
Orlando, Fl
Posts:
343
Plugin Contributions:
0

Re: Free Shipping - some items - some zones - need upgrades

Thanks for the link, I will try these changes.

Once they are complete, will the other shipping options be available when free ship products are selected.

For example, If, they wanted to upgrade the shipping to 2nd Day or Overnight.

Thanks again

~D

11 Aug 2011, 3:32 AM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Free Shipping - some items - some zones - need upgrades

There are a number of ways to make the shipping modules work at the same time as the Free Shipping ...

What is the ultimate goal here?

11 Aug 2011, 1:03 PM
#7
djdavedawson avatar

djdavedawson

Zen Follower

Join Date:
Jul 2005
Location:
Orlando, Fl
Posts:
343
Plugin Contributions:
0

Re: Free Shipping - some items - some zones - need upgrades

The ultimate goal is to have just a few products that include Ground shipping. If a customer selects an item that is "free ship", they also have a choice to pay for faster shipping.

11 Aug 2011, 3:56 PM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Free Shipping - some items - some zones - need upgrades

If you add weight to all Products ... and mark those for Free Shipping to the US as Always Free Shipping ...

You can make the following customizations ...

Make a Zone Definition defined for the US Only ...

Install the Free Shipping Options freeoptions instead of the FREE SHIPPING! freeshipper ... and set the Total >= 0 and set the Zone to the new Zone Definition for the US Only ...

Edit the code for:
/includes/modules/shipping/freeoptions.php

to include the code in RED:

      // disable only when entire cart is free shipping
      if (zen_get_shipping_enabled($this->code)) {
          $this->enabled = ((MODULE_SHIPPING_FREEOPTIONS_STATUS == 'True') ? true : false);
      }

// bof: Always Free Shipping
      if (!IS_ADMIN_FLAG) {
        global $cart;
echo 'Always Free: ' . $_SESSION['cart']->in_cart_check('product_is_always_free_shipping','1') . ' Count: ' .  $_SESSION['cart']->count_contents();
        if ($_SESSION['cart']->in_cart_check('product_is_always_free_shipping','1') == $_SESSION['cart']->count_contents()) {
          $this->enabled = true;
        }
      }
// eof: Always Free Shipping

      if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FREEOPTIONS_ZONE > 0) ) {

Edit the code for the UPS shipping module with the code in RED:

    // disable only when entire cart is free shipping
//    if (zen_get_shipping_enabled($this->code)) {
      $this->enabled = ((MODULE_SHIPPING_UPS_STATUS == 'True') ? true : false);
//    }

Edit the code for the shipping class with the code in RED:

  function calculate_boxes_weight_and_tare() {
    global $total_weight, $shipping_weight, $shipping_quoted, $shipping_num_boxes;

// bof: add back Free Shipping
    global $cart;
    $total_weight += $_SESSION['cart']->free_shipping_weight;
//
    if (is_array($this->modules)) {

Now the Free Shipping Options freeoptions will only show for the US when the whole order is Always Free Shipping and the UPS will always show with the proper weight ...

11 Aug 2011, 4:15 PM
#9
djdavedawson avatar

djdavedawson

Zen Follower

Join Date:
Jul 2005
Location:
Orlando, Fl
Posts:
343
Plugin Contributions:
0

Re: Free Shipping - some items - some zones - need upgrades

Thank you Oba-san. Let me try this out.

11 Aug 2011, 9:24 PM
#10
djdavedawson avatar

djdavedawson

Zen Follower

Join Date:
Jul 2005
Location:
Orlando, Fl
Posts:
343
Plugin Contributions:
0

Re: Free Shipping - some items - some zones - need upgrades

Ok, I put this up on the testing server and it works well.

I did have to change this

if ($_SESSION['cart']->in_cart_check('product_is_always_free_shipping','1') == $_SESSION['cart']->count_contents()) {
          $this->enabled = true;
        }

to this

if ($_SESSION['cart']->in_cart_check('product_is_always_free_shipping','1') == $_SESSION['cart']->count_contents()) {
          $this->enabled = true;
        } else {$this->enabled = false;}

So the problem then became how do we handle a mixed cart. With the above solution, A mixed cart would force the customer to pay shipping on the items that were free ship.

I came up with a way to handle a mixed cart, Although my method for recalculating the ground shipping "$mycost" was feeble at best, it's was only off by a dollar or so. I'm hoping there is a more accurate way to do it.

Here is what I did:

Around line 196, i changed this:

$methods[] = array('id' => $type,		
                           'title' => $this->types[$type],
                           'cost' => ($cost * $shipping_num_boxes ) + (MODULE_SHIPPING_UPS_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_UPS_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_UPS_HANDLING) );

to this:

	if ($type=='GND' && $_SESSION['cart']->free_shipping_weight !=0 ) {
		
		if ($_SESSION['cart']->in_cart_check('product_is_always_free_shipping','1') == $_SESSION['cart']->count_contents()) {
		
			} else {
			
			$mycost = $cost * (1-($_SESSION['cart']->free_shipping_weight / ($_SESSION['cart']->free_shipping_weight + $ups_shipping_weight)));
		
        $methods[] = array('id' => $type,		
                           'title' => $this->types[$type] . " (Free Shipping + " . (($ups_shipping_weight * $shipping_num_boxes) - $_SESSION['cart']->free_shipping_weight) ." lbs.)",
                           'cost' => ($mycost * $shipping_num_boxes) + (MODULE_SHIPPING_UPS_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_UPS_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_UPS_HANDLING) );
		}
		
		} else {
			
		$methods[] = array('id' => $type,		
                           'title' => $this->types[$type],
                           'cost' => ($cost * $shipping_num_boxes ) + (MODULE_SHIPPING_UPS_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_UPS_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_UPS_HANDLING) );
		}

What do you think ?

Thanks

11 Aug 2011, 11:48 PM
#11
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Free Shipping - some items - some zones - need upgrades

Are you saying ...

On a cart that is Always Free Shipping ...

the US only gets:
Always Free Shipping

International gets:
UPS for weight of the Product

On a cart that is mixed Normal products and Always Free Shipping ...

the US only gets:
UPS for the weight of ONLY the Products not marked Always Free Shipping

International gets:
UPS for weight of ALL the Products

12 Aug 2011, 12:09 AM
#12
djdavedawson avatar

djdavedawson

Zen Follower

Join Date:
Jul 2005
Location:
Orlando, Fl
Posts:
343
Plugin Contributions:
0

Re: Free Shipping - some items - some zones - need upgrades

Yes, and at the same time, any cart with free ship items, mixed or not will have the ability to upgrade their shipping from Ground at the UPS weight of all the items.

12 Aug 2011, 1:31 AM
#13
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Free Shipping - some items - some zones - need upgrades

Right now, the way the custom code is working is if the cart is Always Free Shipping products only, the US gets:
Free Shipping Options
UPS - for ALL Products with weight

So if you have a Product with the weight of 1.5lbs and marked as Always Free Shipping, the US gets the:
Free Shipping Options
UPS - for 1.5 lb quote

Non-US gets:
UPS - for 1.5 lb quote

If you have a Mixed cart where 1 Product is weight of 1.5lbs and marked as Always Free Shipping and another Product is weight 2lbs and NOT Always Free Shipping the US gets the:
UPS - for 3.5lb quotes

Non-US gets:
UPS - for 3.5lb quotes

What are you wanting that is different? :unsure:

12 Aug 2011, 2:12 AM
#14
djdavedawson avatar

djdavedawson

Zen Follower

Join Date:
Jul 2005
Location:
Orlando, Fl
Posts:
343
Plugin Contributions:
0

Re: Free Shipping - some items - some zones - need upgrades

Ajeh:

If you have a Mixed cart where 1 Product is weight of 1.5lbs and marked as Always Free Shipping and another Product is weight 2lbs and NOT Always Free Shipping the US gets the:
UPS - for 3.5lb quotes

Non-US gets:
UPS - for 3.5lb quotes

The US customer should only have to pay shipping on the 2lbs NOT Always Free Shipping product. In the above scenario, they would have to pay for all 3.5 lbs.

12 Aug 2011, 2:26 AM
#15
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Free Shipping - some items - some zones - need upgrades

Then what happens on the cart that is Always Free Shipping with 1.5 lbs?

Should there be:
US
Free Shipping

International
UPS - 1.5lbs

12 Aug 2011, 2:48 AM
#16
djdavedawson avatar

djdavedawson

Zen Follower

Join Date:
Jul 2005
Location:
Orlando, Fl
Posts:
343
Plugin Contributions:
0

Re: Free Shipping - some items - some zones - need upgrades

Yes. The 1.5 lbs should be free shipping with options to upgrade shipping to 2nd day and such.

12 Aug 2011, 2:52 AM
#17
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Free Shipping - some items - some zones - need upgrades

I am asking if the cart is ONLY Always Free Shipping for 1.5lbs should the US ONLY have:
Free Shipping

Or Should the US have:
Free Shipping
UPS for 1.5lbs

If so, then do you want to limit the UPS to NOT show Ground and only show all of the other shipping methods?

12 Aug 2011, 3:12 AM
#18
djdavedawson avatar

djdavedawson

Zen Follower

Join Date:
Jul 2005
Location:
Orlando, Fl
Posts:
343
Plugin Contributions:
0

Re: Free Shipping - some items - some zones - need upgrades

Ajeh:

Should the US have:
Free Shipping
UPS for 1.5lbs

If so, then do you want to limit the UPS to NOT show Ground and only show all of the other shipping methods?

Yes, and I do want to limit ups to only the other options.

The code I posted on #10 accomplishes this but I don't think calculates the shipping correctly on the NOT always free shipping items in a mixed cart.

I had said in #10 that i made a poor attempt at calculating the addition freight for this scenario.

Also, after further review of the code I posted it is only working as expected when it's inside the US, outside the US needs some work still.

12 Aug 2011, 4:03 AM
#19
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Free Shipping - some items - some zones - need upgrades

Put the shipping class back to the original and try this code in it instead:

  function calculate_boxes_weight_and_tare() {
    global $total_weight, $shipping_weight, $shipping_quoted, $shipping_num_boxes;

/*
// bof: add back Free Shipping
    global $cart;
    $total_weight += $_SESSION['cart']->free_shipping_weight;
//
*/

// bof: allow 1 zone for Free Shipping and full weight on Always Free Shipping for UPS or USPS
    global $db, $order, $cart;
        $valid_zone_id = 2;
        $check_flag = false;
        $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . $valid_zone_id . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
        while (!$check->EOF) {
          if ($check->fields['zone_id'] < 1) {
            $check_flag = true;
            break;
          } elseif ($check->fields['zone_id'] == $order->delivery['zone_id']) {
            $check_flag = true;
            break;
          }
          $check->MoveNext();
        }

        if ($check_flag == false) {
          // add in Always Free Shipping weight if not in 1 zone
          $total_weight += $_SESSION['cart']->free_shipping_weight;
        } else {
          // allow 1 zone for full cart is Always Free Shipping to add in weight for UPS and USPS
          if ($_SESSION['cart']->in_cart_check('product_is_always_free_shipping','1') == $_SESSION['cart']->count_contents()) {
            $total_weight += $_SESSION['cart']->free_shipping_weight;
          }
        }
// bof: allow 1 zone for Free Shipping and full weight on Always Free Shipping for UPS or USPS

    if (is_array($this->modules)) {

The line in RED should be the value of your Zone Definition for the US Only ...

With that change and the UPS change that I posted earlier and the Free Shipping Options freeoptions change that I posted earlier ...

Aside from the fact that Ground is still showing, does this work right for ALL circumstances for the US and International?

12 Aug 2011, 12:29 PM
#20
djdavedawson avatar

djdavedawson

Zen Follower

Join Date:
Jul 2005
Location:
Orlando, Fl
Posts:
343
Plugin Contributions:
0

Re: Free Shipping - some items - some zones - need upgrades

Just to clarify, I should do these changes in conjunction to what I did on #10.

Thanks again for all your help