Post by k2tec » Mon Dec 06, 2021 6:38 pm

In the Netherlands we have a postcode with 4 numbers and 2 letters, many customers enter this with a space between the numbers and letters.
8107 CN must be 8107CN
How do I get rid of that space.
OpenCart version 3.0.3.7
I tried this in catalog-> controller-> account-> order.php

Code: Select all

'postcode'  => $order_info['shipping_postcode'],
to

Code: Select all

'postcode'  => str_replace(' ', '',$order_info['shipping_postcode']),
and
'postcode'  => preg_replace('/\s+/', '', $order_info['payment_postcode']),
but with both no luck

User avatar
Active Member

Posts

Joined
Mon Apr 12, 2010 8:06 pm

Post by paulfeakins » Mon Dec 06, 2021 8:33 pm

k2tec wrote:
Mon Dec 06, 2021 6:38 pm
In the Netherlands we have a postcode with 4 numbers and 2 letters, many customers enter this with a space between the numbers and letters.
8107 CN must be 8107CN
How do I get rid of that space.
OpenCart version 3.0.3.7
I tried this in catalog-> controller-> account-> order.php

Code: Select all

'postcode'  => $order_info['shipping_postcode'],
to

Code: Select all

'postcode'  => str_replace(' ', '',$order_info['shipping_postcode']),
and
'postcode' => preg_replace('/\s+/', '', $order_info['payment_postcode']),[/code]
but with both no luck
What you've done here should work:

Code: Select all

'postcode'  => str_replace(' ', '',$order_info['shipping_postcode']),
So I suspect the problem is just you haven't cleared and refreshed your OCMOD cache.

https://www.antropy.co.uk/blog/how-to-c ... t-3-0-2-0/

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by k2tec » Mon Dec 06, 2021 10:32 pm

Thanks Paul,
I cleared and refresh my OCMOD cache.
But I check again and clear all the cache and session table of Opencart and Firefox

User avatar
Active Member

Posts

Joined
Mon Apr 12, 2010 8:06 pm

Post by straightlight » Mon Dec 06, 2021 11:14 pm

k2tec wrote:
Mon Dec 06, 2021 10:32 pm
Thanks Paul,
I cleared and refresh my OCMOD cache.
But I check again and clear all the cache and session table of Opencart and Firefox
Server cache issue or the storage folder is not located outside of your public_html folder.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by k2tec » Mon Dec 06, 2021 11:17 pm

The storage is outside the public_html. In the root of my domain.
But on other domains I had also strange problems with the cache in 3.0.3.7

User avatar
Active Member

Posts

Joined
Mon Apr 12, 2010 8:06 pm

Post by straightlight » Mon Dec 06, 2021 11:21 pm

k2tec wrote:
Mon Dec 06, 2021 11:17 pm
The storage is outside the public_html. In the root of my domain.
But on other domains I had also strange problems with the cache in 3.0.3.7
Then, it's a server related response issue. See this solution: viewtopic.php?t=206449#p786660 and perhaps these ones as well:

- viewtopic.php?t=220120#p800206 (samesite cookies)
- viewtopic.php?f=202&t=219633#p797082 (samesite cookies)
- viewtopic.php?f=202&t=219633&start=20#p831192 (samesite cookies)

Then, clear your caches again.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by k2tec » Mon Dec 06, 2021 11:23 pm

Thanks straightlight,
I will try tomorrow. Clear al browser cookies and cache

User avatar
Active Member

Posts

Joined
Mon Apr 12, 2010 8:06 pm

Post by straightlight » Mon Dec 06, 2021 11:26 pm

k2tec wrote:
Mon Dec 06, 2021 11:23 pm
Thanks straightlight,
I will try tomorrow. Clear al browser cookies and cache
Ensure to use the Advanced tab of your browsing history and to choose: 'Since the beginning of time' option in the dropdown menu as to ensure all check boxes are checked prior to clear caches also not to use heavy themes requiring a load of cache such as Journal Framework.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by by mona » Tue Dec 07, 2021 3:24 am

I would suggest you correct the postcode before it is stored in the the database with the order instead of correcting it every time and everywhere you retrieve it.

You could do that in catalog/controller/checkout/confirm.php as that is where the order is saved. with

Code: Select all

$this->session->data['order_id'] = $this->model_checkout_order->addOrder($order_data);

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by k2tec » Tue Dec 07, 2021 5:05 pm

Okay clearing al the caches in OpenCart and the browser did the job and one night good sleep :)

The postal code is regulated by this two lines:

Code: Select all

'postcode'  => $order_info['payment_postcode'],
'postcode'  => $order_info['shipping_postcode'],
I changed the lines into:

Code: Select all

'postcode'  => str_replace(' ', '', $order_info['payment_postcode']),
'postcode'  => str_replace(' ', '', $order_info['shipping_postcode']),
thanks everyone for thinking along.

Forgot to mention templates are never used here, only modified basic OpenCart templates

User avatar
Active Member

Posts

Joined
Mon Apr 12, 2010 8:06 pm

Post by paulfeakins » Tue Dec 07, 2021 7:55 pm

Great stuff.

To do this properly you should move those changes in to vQmods or OCMODS.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by k2tec » Tue Dec 07, 2021 9:43 pm

Good Idee
I will give this information to the builders of the Postcode Checkout .NL

User avatar
Active Member

Posts

Joined
Mon Apr 12, 2010 8:06 pm
Who is online

Users browsing this forum: ravikumar22 and 79 guests