Jump to content
Killersites Forums


  • Posts

  • Joined

  • Last visited

marcel_querin@yahoo.ca's Achievements


Newbie (1/14)



  1. I did some debugging and got the code to work. So for those of you who have that *Fatal error*: Call to a member function on a non-object... Here attached is my code that works and corresponds to what you should have at the end of video 7 (with some commented out debugging stuff). Only difference is my XML file contains Solar Panel stuff instead of food... I'm not 100% sure yet what my error(s) was. Cheers! Marcel ppalmq_FinishedVideo7.zip
  2. It seems that the get_shopping_cart() function returns NULL if the $_SESSION['cart'] exists. function get_shopping_cart() { if (!isset($_SESSION['cart'])) return new ShoppingCart(); else return unserialize($_SESSION['cart']); } Is this normal? I tried var_dump($_SESSION['cart']) and it prints NULL.
  3. Thanks, I did that if (isset($_REQUEST... and it gets past this. This was a non-issue - sorry. The original error still shows. I enabled detailed error reporting now. I got rid of other minor stuff. I still have problems in addToCart.php when I get to the AddItem function. Just before I call AddItem, var_dump($shopping_cart); shows NULL. What should I see with : $shopping_cart = get_shopping_cart(); var_dump($shopping_cart); ?
  4. I noticed in my IIS running PHP 5.3.3 that the following code from addToCart.php stops executing when $product_id steps in... <?php require_once '../functions/functions.php'; $shopping_cart = get_shopping_cart(); echo render_header('Add to Cart'); /* Update cart with a new product */ $product_id = $_REQUEST['id']; /////// < = = = this does not work! $var_dump($product_id); if (product_exists($product_id)) { $shopping_cart->AddItem($product_id); //echo render_notification('item added'); } ?>
  5. I have 2 web servers with 2 versions of PHP running on Windows. My XAMPP uses Apache and PHP 5.3.1 and the code (as of video #7) has this same error. My IIS uses PHP 5.3.3 and the code runs fine. I found this out after wasting some a day. But now that I have a working version, I'm happy again. Ok - now the "Fatal error: Call to a member function AddItem() on a non-object..." does not show. But the cart contents don't show either. I tried this using IE and Firefox. Same deal. Looking at the web page source seems to indicate that the rendering stops when any function from ShoppingCart.php is called. I replaced "$this->items" with "$items" but this does not seem to change results. I will keep trying, but if you guys have any clue, this would be appreciated. I assume you have the code that comes with the video purchase. I can upload my own if you need them. tks Marcel
  • Create New...