Minishop2 zip/postal codes
Which lines of code do I need to change to stop Minishop from removing letters from zip/postal codes?
In my country post codes contain letters as well as numbers. Maybe in the future a system setting could be used to disable this feature.
Thanks.
In my country post codes contain letters as well as numbers. Maybe in the future a system setting could be used to disable this feature.
Thanks.
Комментарии: 7
Thanks for the information.
If anyone else is looking for this, the simple code I came up with was:
<?php
class UKOrderHandler extends msOrderHandler {
public function validate($key, $value) {
if ($key == 'index') {
return substr(preg_replace('/[^a-zA-Z0-9]/iu', '',$value),0,10) ? trim($value) : @$this->order[$key];
}
return parent::validate($key,$value);
}
}
While I've got this working, not stripping out letters in the cart form, when the order is processed the postal code comes out as 0. Only entering numbers passes the postal code as normal though.
Any idea what I'm doing wrong?
Any idea what I'm doing wrong?
It is because of error in model. Type is integer instead of string.
I will fix it in the next version, but you can overload this field by custom plugin right now.
I will fix it in the next version, but you can overload this field by custom plugin right now.
Try to implement this fix.
Yes, that works.
Many thanks.
Many thanks.
Авторизуйтесь или зарегистрируйтесь, чтобы оставлять комментарии.