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.
Daniel Gibson
20 июля 2013, 17:02
modx.pro
1 423
0

Комментарии: 7

Василий Наумкин
20 июля 2013, 21:20
0
You need to extend order class and change validation of postal code.

Here is how-to.
    Daniel Gibson
    20 июля 2013, 21:22
    0
    Thanks for the information.
      Daniel Gibson
      23 июля 2013, 23:02
      0
      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);
      }
       
      }
        Daniel Gibson
        01 августа 2013, 16:43
        0
        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?
      Авторизуйтесь или зарегистрируйтесь, чтобы оставлять комментарии.
      7