Problem with CodeIgniter Cart class |
[eluser]cysquan[/eluser]
Hello everyone, I'm having a little problem with the provided Cart class from CI when I try to add a product that has name contains special character, the cart doesn't seem to work. Code: $data = array( The code above is working with the name not contain any special character, however if I change the name to something similar to this (e.g 'name' => 'intel duo core 1/2') then the product is not added to cart. How can I fix this? Thanks in advance!
[eluser]WanWizard[/eluser]
You will have to modify the product name rules: $this->cart->product_name_rules (a regex that is used to validate the name). The default value is Code: $product_name_rules = '\.\:\-_ a-z0-9'; // alpha-numeric, dashes, underscores, colons or periods
[eluser]MikeeJay[/eluser]
And if you also would like to allow: åäö ÅÄÖ é É How should the regex look like?
[eluser]WanWizard[/eluser]
Without having tried it: maybe this might be of some help: http://www.regular-expressions.info/unicode.html#prop. PHP uses the PRCE engine, which should support this.
[eluser]Fabiano Shark[/eluser]
This worked for me: Code: $this->product_name_rules = '\d\D'; Isto resolve problemas de acentuação no carrinho de compras (cart) do codeigniter. Crédito: http://ellislab.com/forums/viewreply/811712/ |
Welcome Guest, Not a member yet? Register Sign In |