Friday 3 April 2020

Why Codeigniter Shopping Cart doesn't allow any special character in the name?

Codeigniter Cart have some rules for product name in following format :

$product_name_rules = '\w \-\.\:';   (Codeigniter 3).

You can see this rule in Cart Library.

Here no any special character allow in product name. So, need some modification for allow special character. You can add same product name in cart with following modification in your cart class not in default Cart Library.

Add the following syntax before insert cart :


$this->cart->product_name_rules = '[:print:]';


After add this syntax your code looks like :


$this->cart->product_name_rules = '[:print:]';
$this->cart->insert(array());


'[:print:]' - allow to insert product name with special character.

No comments:

Post a Comment