Jump to content

Validation of multi-language fields showing error warnings


Recommended Posts

I am new prestashop developer. I have created a module following documentation. I have difficulty understanding one thing. As I understood, multilanguage fields are set to model as array. Like for example:

$model->title[1] = 'English title';

$model->title[2] = 'Spanish title';

 

But when I submit the form and validate my model, I get warnings:

Warning on line 408 in file /var/www/html/prestashop/classes/Validate.php
[2] preg_match() expects parameter 2 to be string, array given

 

If I go to that line in Validate.php it is really taking array of values and using it as single variable. like this:

$model->title = array(1=>'English title', 2=>'Spanish title');

 

If I remove validation rule, it works fine. 

I think I am missing something. Because my module is too big, I cannot post all content here. and I am not sure where the problem is. Any help is appreciated. If anyone had this problem before please let me know the solution.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...