CodeIgniter Cart library doesnt support cyrillic characters in the product name
Jan 22, 2011
Author: Dr_ViRuS
Web Developers is happy people no they don't.
Why?
When you start some new project u must become Lawyer, Doctor, priest etc.. to understand other cultures, their customs, alphabets religious prohibitions, whether written from left to right or vice versa, which encoding they use and similar trifles. And after that your starting with your technical "highly technological problems"Developing one project for Cyrillic alphabet region i had problem with Codeignatier Cart library because by default CI Cart Library support only Latin charters . Bright side of the coin is that someone before me already had the same problem
CI Cart Library have a filter for titles with a regexp only allowing
alpha-numeric, dashes, underscores, colons or periods
var $product_name_rules = '\.\:\-_ a-z0-9';
Solution 1 on Russian way
Just find and comment out the following part from system/libraries/Cart.php:
if ( ! preg_match("/^[".$this->product_name_rules."]+$/i", $items['name']))
{
log_message('error', 'An invalid name was submitted as the product name: '.$items['name'].' The name can only contain alpha-numeric characters, dashes, underscores, colons, and spaces');
return FALSE;
}
Solution 2 Recommended
After you loading Cart lib add this
$this->cart->product_name_rules .="_-а-яА-Я ";
Example
class Basket extends Controller
{
function Basket ()
{
parent::Controller();
$this->load->library('cart');
$this->cart->product_name_rules .="_-а-яА-Я ";
}
I hope i helped you to fix this "bug" and you get your payment :)
Note : Don't forget to set ci_sessiosn table in UTF-8
views 71288



