Jump to content

PHP products creation - Accent forbidden from product name


Nyphel

Recommended Posts

Hello,

 

I can't understand why, if I try to create a new product using a PHP script, the product name cannot contain accents?

If I try to create same product using Admin page, accents are allowed... 

 

Am I doing something wrong in my PHP script?

$myProduct = new Product();
$myProduct->ean13 = 9999999999999;
$myProduct->name = array((int)Configuration::get('PS_LANG_DEFAULT') =>  'téàè°st');
$myProduct->link_rewrite = array((int)Configuration::get('PS_LANG_DEFAULT') =>  'test');
$myProduct->id_category = 7;
$myProduct->id_category_default = 7;
$myProduct->redirect_type = '404';
$myProduct->price = 10.0;
$myProduct->quantity = 1;
$myProduct->minimal_quantity = 1;
$myProduct->show_price = 1;
$myProduct->on_sale = 0;
$myProduct->online_only = 0;
$myProduct->meta_keywords = 'test';
$myProduct->is_virtual=0;

$myProduct->add();
$myProduct->addToCategories(array(7)); 
Le champ suivant n'est pas valide selon la méthode de validation isCatalogName:
(Product->name = pour la langue 2)

Is there an encoding to be defined in PHP source code?

 

Thanks for your help.

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...