Zen Cart Logo
Forums / Addon Shipping Modules / Difficulty setting up flat rate shipping

Difficulty setting up flat rate shipping

Views: 2,552

Results 1 to 12 of 12
1 Dec 2014, 8:36 PM
#1
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
944
Plugin Contributions:
3

Difficulty setting up flat rate shipping

I'm trying to configure a shipping module to do the following:

All United States (US, VI, etc.) orders above $10: Shipping is $0.99
All others: Orders above $25,shipping is $2.99

I'm trying to follow the steps here:
http://www.zen-cart.com/showthread.php?215262-What-s-best-for-different-domestic-and-international-flat-rate&highlight=flat+rate

And attempted to use both the innate flatrate and the module linked above (I set up two additional payment zones: US/all states and all international zones but the US). However, using either method, I still get $0.00 and a message "The shipping rate cannot be determined at this time". I found the following: http://www.zen-cart.com/showthread.php?207554-The-shipping-rate-cannot-be-determined-at-this-time-Zone-Rates and made sure the Shipping settings were all correct but they still fail.

I'd appreciate any advice on this.

1 Dec 2014, 11:44 PM
#2
ajeh avatar

ajeh

Oba-san

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

Re: Difficulty setting up flat rate shipping

This sounds like the only shipping module you are using is Zone Rate zones ... correct?

If you go to Modules ... Shipping ... and click on Zone Rate zones ... what do you see in the right hand panel?

2 Dec 2014, 12:55 AM
#3
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
944
Plugin Contributions:
3

Re: Difficulty setting up flat rate shipping

Here's what I have:

Zone Based Rates
Enable Zones Method True Calculation Method Price Tax Class --none-- Tax Basis Shipping Sort Order 0 Skip Countries, use a comma separated list of the two character ISO country codes Zone 1 Countries US Zone 1 Shipping Table 25:0.99 Zone 1 Handling Fee 0 Handling Per Order or Per Box Zone 1 (when by weight) Order Zone 2 Countries Zone 2 Shipping Table 3:8.50,7:10.50,99:20.00 Zone 2 Handling Fee 0 Handling Per Order or Per Box Zone 2 (when by weight) Order Zone 3 Countries Zone 3 Shipping Table 3:8.50,7:10.50,99:20.00 Zone 3 Handling Fee 0 Handling Per Order or Per Box Zone 3 (when by weight) Order

Here is my shipping estimator:
Attachment 14740

And the shopping cart is a total of $24.00.

2 Dec 2014, 1:35 AM
#4
ajeh avatar

ajeh

Oba-san

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

Re: Difficulty setting up flat rate shipping

What are you expecting on the Zone Rate zones shipping for New York on $24.00?

2 Dec 2014, 3:29 AM
#5
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
944
Plugin Contributions:
3

Re: Difficulty setting up flat rate shipping

Ajeh:

What are you expecting on the Zone Rate zones shipping for New York on $24.00?

For it not to be listed. The idea is that the table rates would be offered only if the threshold was met.

2 Dec 2014, 6:11 AM
#6
ajeh avatar

ajeh

Oba-san

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

Re: Difficulty setting up flat rate shipping

What shipping happens if those settings are out of scope for the limits ...

2 Dec 2014, 2:15 PM
#7
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
944
Plugin Contributions:
3

Re: Difficulty setting up flat rate shipping

Ajeh:

What shipping happens if those settings are out of scope for the limits ...

The other modules that are installed would still be offered.

Currently I have USPS and UPS installed. The idea is that the USPS and UPS would be offered regardless of order total. I'm generally trying to offer discounted (or free) shipping if a certain condition is met. In this case, the order total. If the order total is not meeting that condition, then the normal shipping totals prevail.

2 Dec 2014, 2:59 PM
#8
ajeh avatar

ajeh

Oba-san

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

Re: Difficulty setting up flat rate shipping

What would be easier is to start with Flat Rate flat shipping module and clone it ...

Next, make a Zone Definition with the DETAILS set for all of the US for one module and then make a Zone Definition with the DETAILS set for the Rest of the World ...

Then you can customize the code in the two shipping modules:
/includes/modules/shipping/flat.php

with the code in RED:

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

[B]// bof: disable if total < 25.00
if (!IS_ADMIN_FLAG && $_SESSION['cart']->show_total() < 25.00) {
  $this->enabled = false;
}
// eof: disable if total < 25.00
[/B]
      if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FLAT_ZONE > 0) ) {

Then, if you cloned the Flat Rate flat shipping module files to, flat2, for example:
/includes/modules/shipping/flat2.php

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

[B]// bof: disable if total < 10.00
if (!IS_ADMIN_FLAG && $_SESSION['cart']->show_total() < 10.00) {
  $this->enabled = false;
}
// eof: disable if total < 10.00
[/B]
      if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FLAT2_ZONE > 0) ) {

Then set the amount for the shipping costs and Zones on these two modules and they should work for you ...

For the Zone Definitions, you can look in the FAQs on a search for:
zones

and you should see:
http://www.zen-cart.com/content.php?308-prepared-zone-definitions

which can assist you in building the Zones for the US and the Rest of the World ...

3 Dec 2014, 3:38 PM
#9
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
944
Plugin Contributions:
3

Re: Difficulty setting up flat rate shipping

Ajeh:

...

This works greatly! Since you also write the USPS module, do you know if there's a way to hide a particular USPS method if the same conditions are met? (Aka a certain price total is met?) For example, if I want to remove the "First Class" methods if this condition is met.

3 Dec 2014, 6:03 PM
#10
ajeh avatar

ajeh

Oba-san

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

Re: Difficulty setting up flat rate shipping

You should be able to edit the file:
/includes.modules/shipping/usps.php

and add the code in RED:

$show_hiddenCost = '';

[B]// bof: skip First-Class over $10.00
if (preg_match('#First\-Class#i', $type_rebuilt)) {
  // skip First-Class > 10.00
//echo 'USPS $type_rebuilt: ' . $type_rebuilt . ' $_SESSION[cart]->total: ' . $_SESSION['cart']->total . '<br>';
} else {
[/B]          $methods[] = array('id' => $type_rebuilt,
                             'title' => $title . $show_hiddenCost,
                             'cost' => $cost,
                             'insurance' => $usps_insurance_charge,
                            );
[B]}
// eof: skip First-Class over $10.00
[/B]
//echo 'setting insurance: ' . $usps_insurance_charge . '<br>';
3 Dec 2014, 8:36 PM
#11
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
944
Plugin Contributions:
3

Re: Difficulty setting up flat rate shipping

One final bit, is there a way to make a call to check an orders shipping weight?

3 Dec 2014, 10:56 PM
#12
ajeh avatar

ajeh

Oba-san

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

Re: Difficulty setting up flat rate shipping

Weight per box will be:
$usps_shipping_weight

Weight of the whole order is:
$_SESSION['cart']->weight