Jump to content

Longitude field Error. I can not enter my google map location.


Recommended Posts

Hello,

 

it seems that the store coordinates works fine except when my location is over Negative 100. I then get the error that says, the Longitude field is too long (12 characters max).

 

Prestashop by default adds zeros and that makes my longitude 13 characters.

What are my options here?

 

Any and all help is appreciated.

 

My coordinates are

33.832979 latitude &

-117.927681 longitude.

post-674262-0-60342500-1377130998_thumb.png

Edited by adriesilva (see edit history)
Link to comment
Share on other sites

Hi,

Unfortunately that rule of 12 characters is located in the PS code, not configurable.

 

1. copy controllers/admin/AdminStoresController.php to override/controllers/admin/

edit override/controllers/admin/AdminStoresController.php line 224

change

'maxlength' => 12,

to

'maxlength' => 14,

 

2. copy classes/Store.php to override/classes/

edit override/classes/Store.php line 94, 95

change

'latitude' =>   array('type' => self::TYPE_FLOAT, 'validate' => 'isCoordinate', 'size' => 12),
'longitude' =>  array('type' => self::TYPE_FLOAT, 'validate' => 'isCoordinate', 'size' => 12),

to

'latitude' =>   array('type' => self::TYPE_FLOAT, 'validate' => 'isCoordinate', 'size' => 14),
'longitude' =>  array('type' => self::TYPE_FLOAT, 'validate' => 'isCoordinate', 'size' => 14),

 

3. IMPORTANT: go to folder cache, DELETE file class_index.php after you finish copy and editing those two files

 

by using override folder, you will not break anything in PS core, and your PS installation is still fully upgradable.

  • Like 1
Link to comment
Share on other sites

×
×
  • Create New...