Cart Library Reject any "bad" Character - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Cart Library Reject any "bad" Character (/showthread.php?tid=41206) |
Cart Library Reject any "bad" Character - El Forum - 05-01-2011 [eluser]edidiway[/eluser] Hi. I have been frustated for an hour maybe because this bug. I am building online shop website now, and you know, when I was testing it, I used 2 products for example.. The first product name was "Product 1" and the second was "Product #2" and what happen if I add to cart? "Product 1" will be inserted to the cart while in the other hand "product #2" will be never inserted to the cart.. can someone fix this problem? I have searched at google and no answer. There is 1 thread I have found, but no solution anyway. this is the thread "http://ellislab.com/forums/viewthread/136051/#672421" if there is no solution, I affraid that my client can not use "bad" character in inserting the product name Cart Library Reject any "bad" Character - El Forum - 05-01-2011 [eluser]oppenheimer[/eluser] As the post you referenced suggest, you can modify the cart class to your needs. It is system/library/cart.php. Modify line 31 (at least in my version) to add a pound sign. Code: var $product_name_rules = '\.\:\-_ a-z0-9#'; Cart Library Reject any "bad" Character - El Forum - 05-02-2011 [eluser]edidiway[/eluser] Hi oppenheimer, thanks.. this solution is very good Cart Library Reject any "bad" Character - El Forum - 05-02-2011 [eluser]davidbehler[/eluser] Never modify a file in /system. It will be overwritten the next time you update CI. Instead you should extend the library in /application/libraries/cart.php. See the "Extending Native Libraries" section in the Guide if you don't know what I'm talking about. Cart Library Reject any "bad" Character - El Forum - 05-02-2011 [eluser]WanWizard[/eluser] Alternatively, just do Code: $this->load->library('cart'); But walmeisters suggestion is the preferred way. Cart Library Reject any "bad" Character - El Forum - 05-02-2011 [eluser]edidiway[/eluser] both waldmeister and wanwizard solutions are excellent I think. but in this case I will use from wanwizard, it is quite simple. But in certain case, waldmeister solution was a good one. Very thanks to all for the solutions |