![]() |
Odd Cart Behavior - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Odd Cart Behavior (/showthread.php?tid=52790) Pages:
1
2
|
Odd Cart Behavior - El Forum - 06-26-2012 [eluser]RMinor[/eluser] I am offering free products if certain criteria are met and I am getting the following error when I try to add the free product to the cart "ERROR - 2012-06-26 16:14:13 --> An invalid price was submitted for product ID: 38". I am trying to send the price as 0.00, and i have also tried (float)0.00, and '0.00'. Nothing works. Does anyone have any ideas? Odd Cart Behavior - El Forum - 06-26-2012 [eluser]InsiteFX[/eluser] Try .00 if not then you would need to extend the cart class and fix it the current function removes all 0 before the decimal point. Odd Cart Behavior - El Forum - 06-26-2012 [eluser]RMinor[/eluser] That did not work. Are there any updates to the cart class that would fix this. I am using version 2.1.0 right now. Odd Cart Behavior - El Forum - 06-27-2012 [eluser]RMinor[/eluser] Nothing I have tried thus far has worked. What would I need to do as far as extending the cart class that would enable it to accept 0.00 as a price? Odd Cart Behavior - El Forum - 06-28-2012 [eluser]Matalina[/eluser] does 0 not work? this is what I do: Code: $data = array( Odd Cart Behavior - El Forum - 06-28-2012 [eluser]RMinor[/eluser] I had that at first. Here is my add method from my cart controller. Note that in this particular instance the 'free_nail' or 'free_tanktop' attribute will be TRUE, so the price gets reset as 0.00 (I have included comments where it happens). The error logs are telling me that the price is invalid. Code: public function add($options_to_check = array('color', 'size', 'free_nail', 'free_tanktop')) Odd Cart Behavior - El Forum - 06-28-2012 [eluser]Matalina[/eluser] The difference between my code and your code is: Code: $price = '0.00' // a string Odd Cart Behavior - El Forum - 06-28-2012 [eluser]RMinor[/eluser] The weird thing is that I had it as '0.00' too and it still would not work. Odd Cart Behavior - El Forum - 06-28-2012 [eluser]Matalina[/eluser] You also have: Code: 'price' => (float)$price Odd Cart Behavior - El Forum - 06-28-2012 [eluser]RMinor[/eluser] Well, I put the price variable as a float Code: $price = 0.00; |