Claudia M Posted December 1, 2017 Share Posted December 1, 2017 (edited) 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 December 1, 2017 by Claudia M Quote Link to comment Share on other sites More sharing options...
Claudia M Posted December 29, 2017 Author Share Posted December 29, 2017 Anyone know what I should do? Quote Link to comment Share on other sites More sharing options...
bsmither Posted December 29, 2017 Share Posted December 29, 2017 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. Quote Link to comment Share on other sites More sharing options...
bsmither Posted December 29, 2017 Share Posted December 29, 2017 I have replicated this situation. Looking into why "Use First Matching Zone" is not being honored. Quote Link to comment Share on other sites More sharing options...
Claudia M Posted December 29, 2017 Author Share Posted December 29, 2017 That's great! ... In a bad way LOL. Please let me know what you find out Quote Link to comment Share on other sites More sharing options...
bsmither Posted December 29, 2017 Share Posted December 29, 2017 Try this edit: In All in One Shipping module, shipping.class.php, near line 212, find: $this->debug(sprintf('<strong>>>> 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>>>> 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)'); } Quote Link to comment Share on other sites More sharing options...
Claudia M Posted December 29, 2017 Author Share Posted December 29, 2017 I have to set up some rates then I'll try it. i'll let you know. Thanks, Brian Quote Link to comment Share on other sites More sharing options...
Claudia M Posted December 30, 2017 Author Share Posted December 30, 2017 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? Quote Link to comment Share on other sites More sharing options...
bsmither Posted December 30, 2017 Share Posted December 30, 2017 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. Quote Link to comment Share on other sites More sharing options...
Claudia M Posted December 30, 2017 Author Share Posted December 30, 2017 Let me fool with this a little more - input more rates, zip codes, etc. Might take a day or 2. I'll let you know. Thanks! Quote Link to comment Share on other sites More sharing options...
Claudia M Posted January 12, 2018 Author Share Posted January 12, 2018 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> 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> Quote Link to comment Share on other sites More sharing options...
bsmither Posted January 12, 2018 Share Posted January 12, 2018 "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. Quote Link to comment Share on other sites More sharing options...
Claudia M Posted January 12, 2018 Author Share Posted January 12, 2018 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. Quote Link to comment Share on other sites More sharing options...
bsmither Posted January 12, 2018 Share Posted January 12, 2018 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. Quote Link to comment Share on other sites More sharing options...
Claudia M Posted January 12, 2018 Author Share Posted January 12, 2018 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. Quote Link to comment Share on other sites More sharing options...
bsmither Posted January 12, 2018 Share Posted January 12, 2018 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. Quote Link to comment Share on other sites More sharing options...
Claudia M Posted January 12, 2018 Author Share Posted January 12, 2018 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 Quote Link to comment Share on other sites More sharing options...
bsmither Posted January 12, 2018 Share Posted January 12, 2018 (edited) "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 January 12, 2018 by bsmither Quote Link to comment Share on other sites More sharing options...
Claudia M Posted January 12, 2018 Author Share Posted January 12, 2018 I'll try that, thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.