[Skip to main content](#vessel-content)

#   Verification function of Postcode needed - Auspost

##

- **[tekwizard](/forum/user/7072-tekwizard "View tekwizard's Profile")**
- [![tekwizard's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/7072-tekwizard "View tekwizard's Profile") Topic Author
- [ Offline](/forum/user/7072-tekwizard)

Less More

- Posts: 7
- Thank you received: 0
-
-

14 years 6 months ago [\#48957](#48957) by [tekwizard](/forum/user/7072-tekwizard "View tekwizard's Profile")  *[Verification function of Postcode needed - Auspost](/forum/3-bug-report/48957-verification-function-of-postcode-needed-auspost#48957 "When a customer enters the wrong postcode then this leads to a $0 postage fee. This happens easily from an Apple computer with Safari with the Autofill function - the postcode is not properly inserted - instead the address data (street/number) ends up in the postcode field as well. There need to be a function to validate the postcode (in Australia numeric/4digits) and produce an error message before processing the final check-out.")* was created by *[tekwizard](/forum/user/7072-tekwizard "View tekwizard's Profile")*

When a customer enters the wrong postcode then this leads to a $0 postage fee.
This happens easily from an Apple computer with Safari with the Autofill function - the postcode is not properly inserted - instead the address data (street/number) ends up in the postcode field as well. There need to be a function to validate the postcode (in Australia numeric/4digits) and produce an error message before processing the final check-out.

- [ ![ScreenShot2012-05-02at9.05.32PM.png](/forum/attachment/3725) ](/forum/attachment/3725 "...t9.05.32PM.png") [ ](/forum/attachment/3725?download=1 "...t9.05.32PM.png")
- [ ![ScreenShot2012-05-02at9.05.50PM.png](/forum/attachment/3726) ](/forum/attachment/3726 "...t9.05.50PM.png") [ ](/forum/attachment/3726?download=1 "...t9.05.50PM.png")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC80ODk1Ny12ZXJpZmljYXRpb24tZnVuY3Rpb24tb2YtcG9zdGNvZGUtbmVlZGVkLWF1c3Bvc3Q/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86320
- Thank you received: 14279
-
-

14 years 6 months ago [\#49035](#49035) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Verification function of Postcode needed - Auspost](/forum/3-bug-report/48957-verification-function-of-postcode-needed-auspost#49035 "When a customer enters the wrong postcode then this leads to a $0 postage fee. This happens easily from an Apple computer with Safari with the Autofill function - the postcode is not properly inserted - instead the address data (street/number) ends up in the postcode field as well. There need to be a function to validate the postcode (in Australia numeric/4digits) and produce an error message before processing the final check-out.")*

Hi,

Change the code: Code:

if(empty($order-&gt;shipping_address-&gt;address_post_code)){ $zoneClass=hikashop_get('class.zone'); $zones = $zoneClass-&gt;getOrderZones($order); $db =&amp; JFactory::getDBO(); $db-&gt;setQuery('SELECT zone_namekey FROM '.hikashop_table('zone').' WHERE zone_code_3='.$db-&gt;Quote('AUS')); $australia_zone = $db-&gt;loadResult(); if(in_array($australia_zone,$zones)){ $messages['post_code_missing'] = 'The Australia Post shipping plugin requires the user to enter a postal code when goods are shipped within Australia. Please go to "Display-&gt;Custom fields" and set the post code field to required.'; continue; } }

to: Code:

$check = false; if(empty($order-&gt;shipping_address-&gt;address_post_code)){ $check = true; $message = 'The Australia Post shipping plugin requires the user to enter a postal code when goods are shipped within Australia. Please go to "Display-&gt;Custom fields" and set the post code field to required.'; }elseif(!preg_match('#[0-9]{4}#',$order-&gt;shipping_address-&gt;address_post_code)){ $check = true; $message = 'The post code entered is not valid'; } if($check){ $zoneClass=hikashop_get('class.zone'); $zones = $zoneClass-&gt;getOrderZones($order); $db =&amp; JFactory::getDBO(); $db-&gt;setQuery('SELECT zone_namekey FROM '.hikashop_table('zone').' WHERE zone_code_3='.$db-&gt;Quote('AUS')); $australia_zone = $db-&gt;loadResult(); if(in_array($australia_zone,$zones)){ $messages['post_code_missing'] = $message; continue; } }

in the file plugins/hikashopshipping/aupost.php and that should do the job.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC80ODk1Ny12ZXJpZmljYXRpb24tZnVuY3Rpb24tb2YtcG9zdGNvZGUtbmVlZGVkLWF1c3Bvc3Q/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Mike2001](/forum/user/6462-mike2001 "View Mike2001's Profile")**
- [![Mike2001's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/6462-mike2001 "View Mike2001's Profile")
- [ Offline](/forum/user/6462-mike2001)

Less More

- Posts: 28
- Thank you received: 2
-
-

14 years 6 months ago [\#49038](#49038) by [Mike2001](/forum/user/6462-mike2001 "View Mike2001's Profile")  Replied by *[Mike2001](/forum/user/6462-mike2001 "View Mike2001's Profile")* on topic *[Re: Verification function of Postcode needed - Auspost](/forum/3-bug-report/48957-verification-function-of-postcode-needed-auspost#49038 "When a customer enters the wrong postcode then this leads to a $0 postage fee. This happens easily from an Apple computer with Safari with the Autofill function - the postcode is not properly inserted - instead the address data (street/number) ends up in the postcode field as well. There need to be a function to validate the postcode (in Australia numeric/4digits) and produce an error message before processing the final check-out.")*

Would this be easy to change for use in the USPS plug in? If not could I get you to help me with it?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC80ODk1Ny12ZXJpZmljYXRpb24tZnVuY3Rpb24tb2YtcG9zdGNvZGUtbmVlZGVkLWF1c3Bvc3Q/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[tekwizard](/forum/user/7072-tekwizard "View tekwizard's Profile")**
- [![tekwizard's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/7072-tekwizard "View tekwizard's Profile") Topic Author
- [ Offline](/forum/user/7072-tekwizard)

Less More

- Posts: 7
- Thank you received: 0
-
-

14 years 6 months ago [\#49057](#49057) by [tekwizard](/forum/user/7072-tekwizard "View tekwizard's Profile")  Replied by *[tekwizard](/forum/user/7072-tekwizard "View tekwizard's Profile")* on topic *[Re: Verification function of Postcode needed - Auspost](/forum/3-bug-report/48957-verification-function-of-postcode-needed-auspost#49057 "When a customer enters the wrong postcode then this leads to a $0 postage fee. This happens easily from an Apple computer with Safari with the Autofill function - the postcode is not properly inserted - instead the address data (street/number) ends up in the postcode field as well. There need to be a function to validate the postcode (in Australia numeric/4digits) and produce an error message before processing the final check-out.")*

Thanks for the quick fix - I have tested it and it works good. Are you publishing an official version of the Auspost plugin soon with all the changes? Or are they already included in the official packages? We are considering getting the business version soon and want to make sure the version will be up to date.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC80ODk1Ny12ZXJpZmljYXRpb24tZnVuY3Rpb24tb2YtcG9zdGNvZGUtbmVlZGVkLWF1c3Bvc3Q/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86320
- Thank you received: 14279
-
-

14 years 5 months ago [\#49132](#49132) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Verification function of Postcode needed - Auspost](/forum/3-bug-report/48957-verification-function-of-postcode-needed-auspost#49132 "When a customer enters the wrong postcode then this leads to a $0 postage fee. This happens easily from an Apple computer with Safari with the Autofill function - the postcode is not properly inserted - instead the address data (street/number) ends up in the postcode field as well. There need to be a function to validate the postcode (in Australia numeric/4digits) and produce an error message before processing the final check-out.")*

The same code is used int he USPS plugin: Code:

if(empty($order-&gt;shipping_address-&gt;address_post_code)){ $zoneClass=hikashop_get('class.zone'); $zones = $zoneClass-&gt;getOrderZones($order); $db =&amp; JFactory::getDBO(); $db-&gt;setQuery('SELECT zone_namekey FROM '.hikashop_table('zone').' WHERE zone_code_3='.$db-&gt;Quote('USA')); $usa_zone = $db-&gt;loadResult(); if(in_array($us_zone,$zones)){ $messages['post_code_missing'] = 'The USPS shipping plugin requires the user to enter a postal code when goods are shipped within the United States. Please go to "Display-&gt;Custom fields" and set the post code field to required.'; continue; } }

So you can do the same modification: Code:

$check = false; if(empty($order-&gt;shipping_address-&gt;address_post_code)){ $check = true; $message = 'The USPS shipping plugin requires the user to enter a postal code when goods are shipped within the United States. Please go to "Display-&gt;Custom fields" and set the post code field to required.'; }elseif(!preg_match('#^[0-9]{5}(-?[0-9]{4})?$#',$order-&gt;shipping_address-&gt;address_post_code)){ $check = true; $message = 'The post code entered is not valid'; } if($check){ $zoneClass=hikashop_get('class.zone'); $zones = $zoneClass-&gt;getOrderZones($order); $db =&amp; JFactory::getDBO(); $db-&gt;setQuery('SELECT zone_namekey FROM '.hikashop_table('zone').' WHERE zone_code_3='.$db-&gt;Quote('USA')); $usa_zone = $db-&gt;loadResult(); if(in_array($usa_zone,$zones)){ $messages['post_code_missing'] = $message; continue; } }

The aupost being included in HikaShop, the modification will be in next version of HikaShop.
It won't be added until then, but you can just reapply it after upgrading if you want to upgrade before the next version.

The following user(s) said Thank You: [Mike2001](/forum/user/6462-mike2001 "View Mike2001's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC80ODk1Ny12ZXJpZmljYXRpb24tZnVuY3Rpb24tb2YtcG9zdGNvZGUtbmVlZGVkLWF1c3Bvc3Q/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Mike2001](/forum/user/6462-mike2001 "View Mike2001's Profile")**
- [![Mike2001's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/6462-mike2001 "View Mike2001's Profile")
- [ Offline](/forum/user/6462-mike2001)

Less More

- Posts: 28
- Thank you received: 2
-
-

14 years 5 months ago [\#49620](#49620) by [Mike2001](/forum/user/6462-mike2001 "View Mike2001's Profile")  Replied by *[Mike2001](/forum/user/6462-mike2001 "View Mike2001's Profile")* on topic *[Re: Verification function of Postcode needed - Auspost](/forum/3-bug-report/48957-verification-function-of-postcode-needed-auspost#49620 "When a customer enters the wrong postcode then this leads to a $0 postage fee. This happens easily from an Apple computer with Safari with the Autofill function - the postcode is not properly inserted - instead the address data (street/number) ends up in the postcode field as well. There need to be a function to validate the postcode (in Australia numeric/4digits) and produce an error message before processing the final check-out.")*

Thanks again Nicolas...

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC80ODk1Ny12ZXJpZmljYXRpb24tZnVuY3Rpb24tb2YtcG9zdGNvZGUtbmVlZGVkLWF1c3Bvc3Q/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.060 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)

[](#top)
