Claudia M

All in One Shipping showing too many rates

Recommended Posts

I am setting up new zones in the All in One Shipping module so I can use zip codes.  Example:  Zone 2 (This is the name I gave in AIOS) is for the states kentucky and indiana.  I just now created a Zone 2 Zips to show the zip codes for Zone 2 based on the UPS zone chart (for zip codes).  I have the “Use first matching zone only” set in the AIOS module, but it is still giving me rates for both zones.  I need it to show the rates for the zip code.  If zip code is not available then go to the state zone.

Here is the AIOS debug info:

- Postcode range search: 42100 - 42799   (MATCHED!)
>>> Shipping zone [ID 46] matches the delivery address! Use this zone for shipping calculations.
Looking for first matching zone of best match (instead of searching for all matching zones - see AIOS module settings)
Zone 2 [Zone ID 1] --- Country matched and state/province matched! [IN, KY]
>>> Shipping zone [ID 1] matches the delivery address! Use this zone for shipping calculations.
Looking for first matching zone of best match (instead of searching for all matching zones - see AIOS module settings)

and at the bottom:

FINAL SHIPPING OPTIONS FOR THIS ADDRESS AND BASKET

USPS: First Class: 3.18
USPS: Priority: 6.55
USPS: Parcel Select Ground: 6.55
UPS Standard Ground: 13.04
USPS First Class: 3.18

Thanks,

Claudia

Edited by Claudia M

Share this post


Link to post
Share on other sites

Looking at the code for AIOS v1.0.10, I do not find anything that is wrong with the code.

What I do find is a set of diagnostic phrases that are very misleading.

The code seems to be testing all zones, not stopping at the first, even if matched. But if "First" is selected, then only only the first matched zone is returned, containing all the various shipping methods in that zone.

It may help if you were to send me the contents of CubeCart_shipping_rates and CubeCart_shipping_zones, and the hash from CubeCart_config, the All-In_One_Shipping row.

Share this post


Link to post
Share on other sites

Try this edit:

In All in One Shipping module, shipping.class.php, near line 212, find:

$this->debug(sprintf('<strong>&gt;&gt;&gt; Shipping zone [ID %s] matches the delivery address! Use this zone for shipping calculations.</strong>', $this->_all_zones[$i]['id']));
if ($this->_settings['multiple_zones'] == 'first') {
	$this->debug('Looking for first matching zone of best match (instead of searching for all matching zones - see AIOS module settings)');
} else {
	$this->debug('Searching for all matching shipping zones (instead of stopping at first matching zone - see AIOS module settings)');
}

Change to:

$this->debug(sprintf('<strong>&gt;&gt;&gt; Shipping zone [ID %s] matches the delivery address! Use this zone for shipping calculations.</strong>', $this->_all_zones[$i]['id']));
if ($this->_settings['multiple_zones'] == 'first') {
	$this->debug('Looking for first matching zone of best match (instead of searching for all matching zones - see AIOS module settings)');
	$closest_match_zone_id = $this->_all_zones[$i]['id'];
	break;
} else {
	$this->debug('Searching for all matching shipping zones (instead of stopping at first matching zone - see AIOS module settings)');
}

 

Share this post


Link to post
Share on other sites

I setup  a few rates for my state and purchase an item.  In viewing the cart it does not show the multiple rates as in the first post.  Thank you!  However, it I put Kentucky as the state and a California Zip code (or any non kentucky zip code)  It will show the estimated shipping rate for Kentucky, not the zip code.  Any way for the shipping estimate to go by the zip code, not the State?

Share this post


Link to post
Share on other sites

The code suggests that searching on the zip code happens first.

All the zones are examined. For each zone, if it has anything entered in the zipcode box, the code ranges are parsed and compared to the first five digits of the delivery zip code of the order.

If the delivery zip code does not fall within a range, then another comparison is made with the assumption the zone's zip codes are expressions (for example, 900* is for all of Los Angeles).

If the zone has no postcodes specified for it, then the code tries matching any states that were chosen for this zone. (You can have postcodes or states or neither, not both.)

If your test delivery address is not getting a match in a range or an expression of zip codes, we will need to verify that the range or expression is stated correctly.

Share this post


Link to post
Share on other sites
On 12/29/2017 at 7:18 PM, bsmither said:

The code suggests that searching on the zip code happens first.

All the zones are examined. For each zone, if it has anything entered in the zipcode box, the code ranges are parsed and compared to the first five digits of the delivery zip code of the order.

If the delivery zip code does not fall within a range, then another comparison is made with the assumption the zone's zip codes are expressions (for example, 900* is for all of Los Angeles).

If the zone has no postcodes specified for it, then the code tries matching any states that were chosen for this zone. (You can have postcodes or states or neither, not both.)

If your test delivery address is not getting a match in a range or an expression of zip codes, we will need to verify that the range or expression is stated correctly.

See previous post:  I'm sorry, I should have clarified.  This is for the estimated shipping.  I've inputted more zones and rates and it is still going by the state first then the zip code.  Anyway to have the zip code rates chosen first and then the state in the shipping estimate. I've only checked in checkout-medium-up.  Here is my code:

<tr>
          <td class="bgw txt pad-top bd-top"colspan="6">
               {if $ESTIMATE_SHIPPING}
               <a class="bgw" href="#">Get a Shipping Estimate for your Delivery Address</a>
               <div>
                  <div class="txt font-wgt-norm">Specify your delivery address below. All information is required to get an accurate quote</div>
                 <div class="thinpad-top"><span class="page-tag-sm font-wgt-norm font-burg">For locations outside of the United States and its territories please <a class="uline" href="/contact-us.html"target="_blank" title="Contact Us">contact us.</a>
               &nbsp;&nbsp;  Why we have this <a class="uline" href="/payments-/-shipping.html"target="_blank" title="International Shipping Policy">International Shipping Policy</a>
                 </span></div>
 <div class="pad-top"for="estimate_country">Country and US Territories</div>
                  <select name="estimate[country]" id="estimate_country"  class="nosubmit country-list" rel="estimate_state">
                     {foreach from=$COUNTRIES item=country}<option value="{$country.numcode}" {$country.selected}>{$country.name}</option>{/foreach}
                  </select>
                 <div for="estimate_state">{$LANG.address.state}</div>
                  <input type="text" name="estimate[state]" id="estimate_state" value="{$ESTIMATES.state}" placeholder="{$LANG.address.state}">
                  <div for="estimate_postcode">{$LANG.address.postcode}</div>
                  <input type="text" value="{$ESTIMATES.postcode}" id="estimate_postcode" placeholder="{$LANG.address.postcode}" name="estimate[postcode]">
                  <input type="submit" name="get-estimate" class="button expand" value="{$LANG.basket.fetch_shipping_rates}">
                  <script type="text/javascript">
                  var county_list = {$STATE_JSON};
                  </script>
               </div>
               {/if}
            </td></tr>

 

Share this post


Link to post
Share on other sites

"This is for the estimated shipping."

As when CubeCart does not know the true delivery address of the customer?

If so, then CubeCart uses the store's address as an estimate (which generally is way off but maybe better than nothing). In admin, you can disable the display of estimated shipping and taxes.

The code posted above is not anything I recognize. Please remind us what file where the above code can be found.

I think I found it. Looking.

Share this post


Link to post
Share on other sites

Correct:  As when CubeCart does not know the true delivery address of the customer?

"The code posted above is not anything I recognize. Please remind us what file where the above code can be found." My lines (Custom skin based on Foundation) 93 -116 in :skin/templates/content.checkout.medium-up.php 

I'd really rather not disable the estimated shipping and taxes.  If it can't show the zip code rates first, then the state rates if they can't find the zip code, I guess I can remove the states from the estimate, but I might have missed a zip code when inputting my zones / rates.

Share this post


Link to post
Share on other sites

This just saves a destination address in CubeCart's internally managed basket contents. At some point in delivering the next page, the shipping should be re-calculated.

Still looking.

Share this post


Link to post
Share on other sites

It does recalculate each time I input a different state and zip code.  I want the estimate based on the zip code and if no zip code found then based on the state. Now it is based on the state. Using the state isn't always correct as some zips you would think would be for one state is really for another.

Share this post


Link to post
Share on other sites

AIOS seems to be working according to my zones.

I have a zone for a specific city where the zip codes are a pattern: (example) 97*, 98*

If that fails, the next zone is all of specific state: (example) Arizona

If that fails, the next zone is all of the country: (example) United States (no state or zip specified)

If I enter a zip that matches the pattern, I get that rate. Otherwise the state is checked. Then otherwise the country is checked.

We can review your zone criteria and the sort order on the Shipping Zones tab.

Share this post


Link to post
Share on other sites

I first used the AIOS when Estelle created it for CC4.  At that time the instructions said to put the smaller zones first.  Should I reorganize my zones to show the zip zones first? I didn't know this rule applied to CC6

Share this post


Link to post
Share on other sites

"First Matching" suggests putting that which you want matched first at the top of the list.

Zip zones would seem to be the smaller, more tightly focused areas anyway?

Edited by bsmither

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now