Pergunta

I faced an issue that I cannot add item to cart if it contain cyrillic name. In Cart.php I added to variable symbols а-я:

var $product_name_rules = 'абвгдеёжзийклмнопрстуфхцчшщъыьэюя\.\:\-_ a-z0-9';

But it not resolved issue. When I changed an item name to latin it is added to cart.

Foi útil?

Solução

You should add unicode flag to pregmatch in _insert function:

if ( ! preg_match("/^[".$this->product_id_rules."]+$/iu", $items['id']))

and

if ( ! preg_match("/^[".$this->product_name_rules."]+$/iu", $items['name']))

There is good article about this issue: http://wwarlock.blogspot.ru/2010/03/codeigniter.html

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top