Welcome Guest, Not a member yet? Register   Sign In
Escaping special characters
#2

[eluser]MrChuffman[/eluser]
Just ran across this problem and this question popped up on Google, so thought I'd update it for people who come across it later.

CodeIgniter's Cart only accepts alpha-numeric, dashes, colons and periods by default, you'll need to change it to accept apostrophes or any other character you need it to.

We'll be "extending" the CI_Cart, so we'll need to create a file in: application/libraries/MY_Cart.php

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class My_Cart extends CI_Cart {

function __construct() {
  parent::__construct();

  // Update rules to accept ' and &
  $this->product_name_rules = "\.\:\-_ a-z0-9\'&";

} // end __construct

}

after you do that, you'll be good to insert any amount of alpha, numerical, dash, colon, periods, apostrophes and ampersands as you want.


Messages In This Thread
Escaping special characters - by El Forum - 03-15-2012, 07:52 AM
Escaping special characters - by El Forum - 09-06-2012, 08:59 PM
Escaping special characters - by El Forum - 09-07-2012, 04:19 AM



Theme © iAndrew 2016 - Forum software by © MyBB