Help - Shopping cart fails to add item. |
[eluser]Frank Rocco[/eluser]
Hello, The item fails when the description has a / in it. example: B/S INSIGNIA $row->Item_description = "B/S INSIGNIA" $data = array( 'id' => $row->Item, 'qty' => $qty, 'price' => $row->List_price, 'name' => $row->Item_description ); $this->cart->insert($data); if I remove the /, it saves ok. $row->Item_description = "BS INSIGNIA" Thanks CI 1.7.2
[eluser]christophe2[/eluser]
Hello, I have the same problem. I didn't find a way to add the slash to the $product_name_rules variable of the cart class even though I anti-slashed it. I had to remove the entire product name validation. Christophe
[eluser]aggiaggiaggiaggi[/eluser]
same here, there are a number of other chars which prevent products to go in the cart, like ' and ! heres a simple solution. just add your products with the following code: Code: $this->cart->product_name_rules = '[:print:]'; This allows all printable characters in the product name. @codeigniter coders: i think this should be made default, just allowing _ . : is not enough
[eluser]christophe2[/eluser]
It works nicely. Thanks for sharing your solution. Christophe
[eluser]Chalda Pnuzig[/eluser]
Thanks! [quote author="aggiaggiaggiaggi" date="1266331057"] @codeigniter coders: i think this should be made default, just allowing _ . : is not enough[/quote]
[eluser]Brayan[/eluser]
Hey .. Sorry for revive the topic.. but this code Code: $this->cart->product_name_rules = '[:print:]'; only work for names with slashes I need to add products that have latin characters.. like áÓãoâê .. etc. anyone knows how to do that? thanks
[eluser]aggiaggiaggiaggi[/eluser]
well, not tested, but in theory, you should always be able to use '.*' which allows *every* character. (or maybe [.], one of the two should work)
[eluser]Brayan[/eluser]
[quote author="aggiaggiaggiaggi" date="1269276570"]well, not tested, but in theory, you should always be able to use '.*' which allows *every* character. (or maybe [.], one of the two should work)[/quote] thank you.. but this doesn't work. I commented these lines (validation in the cart library): Code: if ( ! preg_match("/^[".$this->product_name_rules."]+$/i", $items['name'])) so now I can add any products, this is a good way for me, 'cause the name of products are already in database.. so NVM ![]() cheers.
[eluser]skunkbad[/eluser]
I've never seen [:print:] used before. Is this a CI thing, or PHP? Got more info? |
Welcome Guest, Not a member yet? Register Sign In |