Welcome Guest, Not a member yet? Register   Sign In
Shopping cart library and input field formating

Hi all,


Previously, i was asking: is there a way to extend/modify ci shopping cart library to make "qty" accept double value. Because it seemed to me that "qty" only accepts integer value. thanks jmadsen, the problem is solved. It turns out that I just need to change the code in system/library/cart file...

Now my questions is:

Is there a way to format input field in such a way: a number with 1 decimal place?

At first glance, lines 161 & 332 use a preg_replace to strip non-numerics, including decimals.

If you extend & change those to:

$items['qty'] = trim(preg_replace('/([^0-9\.])/i', '', $items['qty']));

I think it should work for you.

Hi Jmadsen, Thanks, I just found that.
I edited my question a bit. now i want to know is there a way to format input field. i.e when user do input, they'll see the format is sth like: __._ , and whatever they input first will be pushed to decimal place first, then fill other digits..

uhm...did you just edit & completely change your question? this was about extending the shopping cart a moment ago

Uhm.... don't do that again, ok? When you post a question, leave it there for others.

jQuery Validatation Plugin

How to Mask Input with jQuery



Theme © iAndrew 2016 - Forum software by © MyBB