![]() |
Cart doesn't insert - 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: Cart doesn't insert (/showthread.php?tid=34239) |
Cart doesn't insert - El Forum - 09-23-2010 [eluser]dalunatic[/eluser] Working on my first CI project. Now adding the library cart; using the User Guide and googled tuts. However, I cannot seem to add/insert any product to the cart session where there is an empty array directly after the insert(). I am quite sure to have it setup correctly (db, config). Please who can shine a light in the dark? Code: class Cart extends Controller { Cart doesn't insert - El Forum - 09-23-2010 [eluser]WanWizard[/eluser] What is the return value of Code: $this->cart->insert($add_this); If it returns FALSE, the log will tell you why (if you set the log_threshold to 'error' or higher). Cart doesn't insert - El Forum - 09-23-2010 [eluser]dalunatic[/eluser] In if/else statement it returned FALSE. No explanation unfortunately although Code: $config['log_threshold'] = 4; Cart doesn't insert - El Forum - 09-24-2010 [eluser]WanWizard[/eluser] Looking at the code, it only returns FALSE without logging an error when: - the 'id' field is missing from the array (doesn't seem to be the case here) - the 'qty' field is zero or not numeric (doesn't seem to be the case here) In all other cases there's a log_message() before returning FALSE. Cart doesn't insert - El Forum - 09-24-2010 [eluser]dalunatic[/eluser] Thanks for your swift advice WanWizard! This is what i found in the log file (thought you meant it would produce an error while executing the script). Guess there's a mistake here and thus no ID... DEBUG - 2010-09-24 10:00:43 --> Config Class Initialized DEBUG - 2010-09-24 10:00:43 --> Hooks Class Initialized DEBUG - 2010-09-24 10:00:44 --> URI Class Initialized DEBUG - 2010-09-24 10:00:44 --> Router Class Initialized DEBUG - 2010-09-24 10:00:44 --> Output Class Initialized DEBUG - 2010-09-24 10:00:44 --> Input Class Initialized DEBUG - 2010-09-24 10:00:44 --> XSS Filtering completed DEBUG - 2010-09-24 10:00:44 --> XSS Filtering completed DEBUG - 2010-09-24 10:00:44 --> XSS Filtering completed DEBUG - 2010-09-24 10:00:44 --> Global POST and COOKIE data sanitized DEBUG - 2010-09-24 10:00:44 --> Language Class Initialized DEBUG - 2010-09-24 10:00:45 --> Loader Class Initialized DEBUG - 2010-09-24 10:00:45 --> Helper loaded: form_helper DEBUG - 2010-09-24 10:00:45 --> Helper loaded: url_helper DEBUG - 2010-09-24 10:00:45 --> Database Driver Class Initialized DEBUG - 2010-09-24 10:00:45 --> Session Class Initialized DEBUG - 2010-09-24 10:00:45 --> Helper loaded: string_helper DEBUG - 2010-09-24 10:00:45 --> Encrypt Class Initialized DEBUG - 2010-09-24 10:00:45 --> Session routines successfully run DEBUG - 2010-09-24 10:00:46 --> Cart Class Initialized DEBUG - 2010-09-24 10:00:46 --> Session class already loaded. Second attempt ignored. DEBUG - 2010-09-24 10:00:46 --> Form Validation Class Initialized DEBUG - 2010-09-24 10:00:46 --> Model Class Initialized DEBUG - 2010-09-24 10:00:46 --> Controller Class Initialized DEBUG - 2010-09-24 10:00:46 --> Model Class Initialized ERROR - 2010-09-24 10:00:46 --> An invalid price was submitted for product ID: 7 DEBUG - 2010-09-24 10:00:46 --> Language file loaded: language/english/profiler_lang.php DEBUG - 2010-09-24 10:00:46 --> Helper loaded: text_helper DEBUG - 2010-09-24 10:00:47 --> Final output sent to browser DEBUG - 2010-09-24 10:00:47 --> Total execution time: 2.9402 |