user2027175
user2027175

Reputation: 83

Codeigniter Cart library cannot support cyrillic chars

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.

Upvotes: 0

Views: 270

Answers (1)

CodingFeles
CodingFeles

Reputation: 384

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

Upvotes: 1

Related Questions