Вопрос

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.

Это было полезно?

Решение

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

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top