Forums / Built-in Shipping and Payment Modules / Free Shipping US 48 regardless of price/weight

Free Shipping US 48 regardless of price/weight

Started by sparrowce on 20 Mar 2011, 5:33 PM · Views: 8,215

Results 1 to 20 of 46
20 Mar 2011, 5:33 PM
#1
sparrowce avatar

sparrowce

Zen Follower

Join Date:
Feb 2011
Posts:
207
Plugin Contributions:
0

Free Shipping US 48 regardless of price/weight

I have added the '48 Lower States' zone per this link, using Install SQL Patches, and it worked nicely to create the zone, but am needing help on the next step. Have been reading many posts about free shipping and am a little confused, most discuss the free shipping associated with cost or weight. I'm looking to make sure free shipping activated within US continental 48 states regardless of weight, amount or any other criteria. If location is outside the zone, am needing to add shipping, otherwise free. Using v 1.3.9h, I have the Freeshipper activated. What is the correct way to set this up? Thank you so much.

20 Mar 2011, 5:42 PM
#2
ajeh avatar

ajeh

Oba-san

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

Re: Free Shipping US 48 regardless of price/weight

What shipping method(s) do you want to use for Outside the 48 Lower States that you made? :unsure:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

20 Mar 2011, 6:24 PM
#3
sparrowce avatar

sparrowce

Zen Follower

Join Date:
Feb 2011
Posts:
207
Plugin Contributions:
0

Re: Free Shipping US 48 regardless of price/weight

Thank you. For places where media mail is available, it would be USPS, and probably USPS priority international for overseas, too, most everything is books. I did not create a zone for the outside 48, only the inside lower 48. Sure don't know what I'm doing, thank you for the help.

21 Mar 2011, 1:02 AM
#4
sparrowce avatar

sparrowce

Zen Follower

Join Date:
Feb 2011
Posts:
207
Plugin Contributions:
0

Re: Free Shipping US 48 regardless of price/weight

To complicate matters, I have recently started using Easy Populate to update the products, it has been fantastic and makes it much easier to keep things organized and understandable. However, when I started trying to work with the shipping and get that part right, I noticed the Free Shipping image had disappeared. Checked to be sure the freeshipper was activated, and yes, but when I went into each listing, noticed the shipping was no longer set to free shipping, that it was set to normal shipping rules applying. My image says Free Shipping Continental US Only, so I want it to appear on all products and I'm just needing to make sure there is a way to add a shipping cost in the shopping cart if customer is NOT continental USA.

However, if Easy Populate will wipe out important settings, can anyone advise what settings to watch out for and if this can be overcome? Otherwise I will not use Easy Populate.

Thank you very much for any help, as I am very lost in this.

21 Mar 2011, 4:16 AM
#5
sparrowce avatar

sparrowce

Zen Follower

Join Date:
Feb 2011
Posts:
207
Plugin Contributions:
0

Re: Free Shipping US 48 regardless of price/weight

Found this post, http://www.zen-cart.com/forum/showthread.php?t=171659, and learned how to update all the records to always free shipping using SQL, am thrilled that update products set product_is_always_free_shipping = 1 worked like a charm.

Resolved the lost free shipping image problem, but still looking for advice on how to handle original question, thank you.

22 Mar 2011, 3:40 AM
#6
sparrowce avatar

sparrowce

Zen Follower

Join Date:
Feb 2011
Posts:
207
Plugin Contributions:
0

Re: Free Shipping US 48 regardless of price/weight

My FreeShipping module is using the 48 states zone, and the free shipping image is showing as it should. Am still not clear on the other part about how to set it up to add shipping for those orders outside the zone. Thank you.

22 Mar 2011, 3:44 AM
#7
ajeh avatar

ajeh

Oba-san

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

Re: Free Shipping US 48 regardless of price/weight

Always Free Shipping was designed to give Free Shipping to EVERYONE ... not just SOME people ...

To use Always Free Shipping YES to give Free Shipping to only a Zone of customers, will require quite a bit of customization ...

I think I wrote this up the other day ... but I cannot remember if that was limited to the US and Canada or what ...

You might search around for it and see if you can find it ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

22 Mar 2011, 3:55 AM
#8
sparrowce avatar

sparrowce

Zen Follower

Join Date:
Feb 2011
Posts:
207
Plugin Contributions:
0

Re: Free Shipping US 48 regardless of price/weight

Thank you, I've found some posts, one of them is where you posted the 48 states zone, that worked very nicely once I got the courage to copy/paste into install SQL patches and press send. Please bear with my slowness, am a real noobie and some of the posts are over my head. Possibly I'm not looking at this right. I chose the always free shipping so the image would show up - is there another way to accomplish that and handle the shipping without so much customization? Also, I do not have weights on the listings - do I need to add them so non-48 states/countries can get some kind of shipping estimate? I am open to any ideas on how to accomplish what's needed, thank you.

22 Mar 2011, 4:04 AM
#9
ajeh avatar

ajeh

Oba-san

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

Re: Free Shipping US 48 regardless of price/weight

Without weights, your Weight oriented shipping methods will not work ...

If you are using a shipping method that does not need weight then you are fine ...

I would have to search around and try to find my previous code to make this work and possibly re-write it to work on your specific conditions ...

I will try to do this when I get some free time ... feel free to try to hunt down any posts on this or related topics ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

22 Mar 2011, 4:12 AM
#10
sparrowce avatar

sparrowce

Zen Follower

Join Date:
Feb 2011
Posts:
207
Plugin Contributions:
0

Re: Free Shipping US 48 regardless of price/weight

I will keep looking, thank you very much.

22 Mar 2011, 4:31 PM
#11
ajeh avatar

ajeh

Oba-san

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

Re: Free Shipping US 48 regardless of price/weight

In order to mark ALL Products as Always Free Shipping to show the Free Shipping Icon ... but allow Free Shipping ONLY to the 48 States & DC ...

You need to add weight to ALL of your Products and mark ALL as Always Free Shipping ...

Next, you need to get the Zone id for the US 48 & DC, in this case I am using 21 ... so you would set this to your value:
$valid_zone_id = 21;

Next, you would need to customize the shipping class and the shipping module ...

The code for:
/includes/classes/shipping.php

needs to be changed to:

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

// bof: allow 1 zone only for Always Free Shipping
    global $db, $order, $cart;
        $valid_zone_id = 21;
        $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) {
          $total_weight += $_SESSION['cart']->free_shipping_weight;
        }
// bof: allow 1 zone only for Always Free Shipping


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

Next, you need to customize your shipping module, in this case I am using USPS:
/includes/modules/shipping/usps.php

Change the code to:

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

Add the following new code above the existing code:

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

so it reads:

    global $db, $order, $cart;

        $valid_zone_id = 21;
        $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 == true) {
          $this->enabled = false;
        } else {
          $this->enabled = true;
        }
//    echo 'USPS shipping class delivery: ' . 'checkflag: ' . $check_flag .  '<br> shipping: ' . $order->delivery['country']['id'] . ' state: ' . $order->delivery['state'] . ' zone: ' . $order->delivery['zone']['id'];

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

This should now provide for the US 48 & DC:
FREE SHIPPING! freeshipper

and for the Rest of the World the USPS shipping module ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

23 Mar 2011, 2:35 AM
#12
sparrowce avatar

sparrowce

Zen Follower

Join Date:
Feb 2011
Posts:
207
Plugin Contributions:
0

Re: Free Shipping US 48 regardless of price/weight

Thank you, I am working through these steps you have kindly provided. Used Easy Populate to add weights to all products, wasn't sure how to find the zone id, but when I hovered over the zone in zone definitions, on the bottom of browser I saw zone ID = 21, is there a better way to find it? Next, I found the includes/classes/shipping.php, found the spot to insert the code you've provided, but here is where it gets very fuzzy for me, so sorry.

Am I just inserting it at that spot or am I replacing existing code? IF replacing, where is my start/stop to replace? Same fuzzy about where the other goes or replaces in the usps.php. Also, I had not installed the usps.php and see that I will have to register a web tools account with USPS, and just checked it out - WOW, I do NOT know what I'm doing there, that is for sure! So many API's, links, choices, any tips as best place to start on that? So much to learn, I really appreciate how much help you have provided to me and everyone, thank you so much.

23 Mar 2011, 3:03 AM
#13
sparrowce avatar

sparrowce

Zen Follower

Join Date:
Feb 2011
Posts:
207
Plugin Contributions:
0

Re: Free Shipping US 48 regardless of price/weight

Quick update on the registering/installing the usps shipping module aspect, found the tutorials on that and will follow that, thank you.

23 Mar 2011, 3:24 AM
#14
ajeh avatar

ajeh

Oba-san

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

Re: Free Shipping US 48 regardless of price/weight

I put the new code in red for the shipping.php file ...

For the USPS shipping module, be sure to get the new January 2, 2011 C version from post #26:
http://www.zen-cart.com/forum/showthread.php?t=171314&highlight=USPS+January+2011

and follow all of the steps ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

24 Mar 2011, 3:01 AM
#15
sparrowce avatar

sparrowce

Zen Follower

Join Date:
Feb 2011
Posts:
207
Plugin Contributions:
0

Re: Free Shipping US 48 regardless of price/weight

Thank you, I've made the changes in the php files, and am using the latest usps.php per your link. Registered with USPS and installed the module. Assume I will be able to test it using the shipping estimator? IF so, I don't have something right yet. I had turned off weights previously to show in listings, though I loaded them in products. Do I need to turn them back on?

Also I set the zone in the USPS module to the lower 48 zone and the freeshipping module zone to none. DO I have those backwards? Have tried them both ways and nothing yet, but could be due to weights.

Thank you again, I appreciate the help very much.

24 Mar 2011, 1:59 PM
#16
ajeh avatar

ajeh

Oba-san

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

Re: Free Shipping US 48 regardless of price/weight

What are you seeing when you ship to one of the US 48?

What are you seeing when you ship to Alaska?

What are you seeing when you ship to Canada?

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

25 Mar 2011, 1:29 AM
#17
sparrowce avatar

sparrowce

Zen Follower

Join Date:
Feb 2011
Posts:
207
Plugin Contributions:
0

Re: Free Shipping US 48 regardless of price/weight

Using the shipping estimator I get these results.

To US - $0
To Alaska - $0
To Canada - $0

Tried turning weights on to show them. Tried selecting the lower 48 zone in the freeshipping module and none in the USPS, then flipped it around. I sure don't know what I'm doing. If the weights don't have to be turned on, that would be great, as they don't look right in the listing, at least to me. But more important is getting the shipping set up right. Thank you.

25 Mar 2011, 1:45 AM
#18
ajeh avatar

ajeh

Oba-san

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

Re: Free Shipping US 48 regardless of price/weight

You should have installed the shipping modules for:
USPS
FREE SHIPPING freeshipper

On the FREE SHIPPING freeshipper you should have your Zone for the US 48 set ...

All Products should have weight on the products_weight and the Always Free Shipping turned on ...

The custom code should be added to the:
/includes/classes/shipping.php
/includes/modules/shipping/usps.php

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

25 Mar 2011, 2:28 AM
#19
sparrowce avatar

sparrowce

Zen Follower

Join Date:
Feb 2011
Posts:
207
Plugin Contributions:
0

Re: Free Shipping US 48 regardless of price/weight

Ajeh:

You should have installed the shipping modules for:
USPS
FREE SHIPPING freeshipper

On the FREE SHIPPING freeshipper you should have your Zone for the US 48 set ...

All Products should have weight on the products_weight and the Always Free Shipping turned on ...

The custom code should be added to the:
/includes/classes/shipping.php
/includes/modules/shipping/usps.php

Thank you for your patience, getting closer. Those are the settings I had on the last test, and the changes to code were in those 2 files, though I can't say for sure I did that part right. I have been toggling the show weight on and off after reading this link, https://www.zen-cart.com/tutorials/index.php?article=223, and seeing the numbers were important. Changed it to 3, it was 1. There are also settings in the configuration/shipping that I modified after reading one of your posts talking about max pkg weight and tares. Honestly it is all so over my head. When I added the weights I had figured it up with the box/packaging, so my weight is total weight per book, possibly that is not the right way to do it.

Now when I try California, it says Free Shipping under available shipping methods, but when I try Alaska or Canada, the row under Available Shipping method disappears. Before there was no change regardless of the selections. Thank you.

25 Mar 2011, 2:37 AM
#20
ajeh avatar

ajeh

Oba-san

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

Re: Free Shipping US 48 regardless of price/weight

Could you PM me access to your Zen Cart Admin ...

It might help me figure out what you are doing here ... :unsure:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!