Jump to content
Killersites Forums

mindapolis

Member
  • Content Count

    30
  • Joined

  • Last visited

Everything posted by mindapolis

  1. could you help me figure why it’s not displaying the shipping and total amount. The values are always 0. shoppingcart.php <?php class shoppingCart { protected $items = array(); public function addItem($product_id) { if (array_key_exists($product_id , $this->items)) $this->items[$product_id] = $this->items[$product_id] +1; else $this->items[$product_id] = 1; } public function GetItemCost($product_id) { $cost_string = get_item_cost($product_id); $cost_float = "$cost_string" + 0; return $cost_float * $this->GetItemQuantity($pr
  2. can I email you tomorrow with the answers to your questions
  3. Has anyone had this problem before? ? ? ? ?
  4. I hesitated posting this because most of my errors are stupid mistakes on my end. however, I'm doing the shopping cart video series and I'm stuck at the very end of video 8. I have watched it three or four times and for some reason the quantity isn't matching up with the price. here's the code: shoppingcart.php <?php class shoppingCart { protected $items = array(); public function addItem($product_id) { if (array_key_exists($product_id , $this->items)) $this->items[$product_id] = ($this->items[$product_id] +1); else $this->items[$product_id] = 1;
  5. mindapolis

    error

    You are a doll! Thank you so much! ! ! ! I'll do that right now. Expect an email from Mindy Thomas mindiapolis @ gmail.com
  6. mindapolis

    error

    if someone could PPPPPPPPPPLLLLLEEEEEEEEAAAAAAASSSEEEEEE help me, I would really appreciate it. I got rid of the error message and if you click a treat on treats,php it will redirect to the checkout.php and it displays the table header but not the chosen treat. treats.php <?php require_once("functions.php"); //session_name("treats"); session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'>http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org
  7. mindapolis

    error

    it's giving me another error. Fatal error: Call to a member function addItem() on a non-object in D:\Hosting\5246561\html\checkOut.php on line 19 <?php require_once('functions.php') ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <?php $shopping_cart = get_shopping_c
  8. mindapolis

    error

    had a breakthrough, explain later:)
  9. mindapolis

    error

    When I put print_r($shopping_cart); exit; checkour.php comes up with a blank webpage with no errors. It should display the items chosen from treats.php. However, when I remove print_r($shopping_cart); exit; from checkOut.php I still get this. Fatal error: Call to a member function getItems() on a non-object in D:\Hosting\5246561\html\checkOut.php on line 36
  10. mindapolis

    error

    when I load cheekout.php I get shoppingCart Object ( [items:protected] => Array ( ) ) When I load treats.php it loads everything okay and when I hit "add to cart" it directs it to order.php. It directs it to this page whether or not <?php session_name("treats"); session_start(); ?> is on the page. Ultimately, yes, items from treats.php will go on order.php, but I was using checkout.php as a testing page to get the shopping cart set up. not understanding why treats.php isn't directing items to checkout.php order.php <?php session_name("treats"); session_start
  11. mindapolis

    error

    I did. Here's the code now. It should show the items picked from treats.php. I'm doing the shopping cart video series and I can't get past video 7 checkout page code <?php require_once('functions.php'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'>http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">'>http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> &
  12. mindapolis

    error

    Yes I did and I removed it. Now it says shoppingCart Object ( [items:protected] => Array ( ) )
  13. mindapolis

    error

    now it says Warning: Unexpected character in input: ''' (ASCII=39) state=1 in D:\Hosting\5246561\html\classes\shoppingCart.php on line 19 shoppingCart Object ( [items:protected] => Array ( ) )
  14. mindapolis

    error

    it displays this. shoppingCart Object ( [items:protected] => Array ( ) )
  15. mindapolis

    error

    It displays this now. Warning: array_keys() [function.array-keys]: The first argument should be an array in D:\Hosting\5246561\html\classes\shoppingCart.php on line 13 Warning: Invalid argument supplied for foreach() in D:\Hosting\5246561\html\checkOut.php on line 35 Produt ID quantity Amount Here's the code <?php require_once('functions.php'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Co
  16. mindapolis

    error

    can someone please help me with this?
  17. mindapolis

    error

    What does this error mean? Fatal error: Call to a member function getItems() on a non-object in D:\Hosting\5246561\html\checkOut.php on line 35 <?php class shoppingCart { protected $items = array(); public function addItem($product_id) { if (array_key_exists($product_id , $this->items)) $this->items[$product_id] = $this->items[$product_id] +1; else $this->item[$product_id] = 1; } public function getItems() { return array_keys($this->item); } public function GetItemQuuanity($product_id) { return $this->item[$product_id]
  18. Okay, I figured out one error, but am stuck on another one. Warning: unserialize() expects parameter 1 to be string, object given in D:\Hosting\5246561\html\functions.php on line 24 <?php require_once('classes/shoppingCart.php'); /**DEFINE GLOBALS**/ define('STORE_XML_FILE' , 'catalog.xml'); /*FUNCTIONS*/ session_start(); function get_xml_catalog() { return new SimpleXMLElement(file_get_contents(STORE_XML_FILE)); } function get_shopping_cart() { if (! isset($_SESSION['cart'])) return new shoppingCart(); //starts new cart else return unserialize($_SESS
  19. I found the error. Somehow there were two shoppingCart.php files and the correct one wasn't in the classes folder. Now,, there is another error but let me see if I can figure it out. thanks so much for helping!
  20. Fatal error: Class 'shoppingCart' not found in D:\Hosting\5246561\html\functions.php on line 17
  21. That didn't help. Here's the revised code. <?php class shoppingCart { protected $items = array(); public function addItem($product_id) { if (array_key_exists($product_id , $this->item)) $this->item[$product_id] = $this->item[$product_id] +1; else $this->item[$product_id] = 1; } public function getItems() { return array_keys($this->item); } public function GetItemQuuanity($product_id) { return $this->item[$product_id]; } } ?>
  22. didn't help the error is on checkOut.php functions.php <?php require_once('classes/shoppingCart.php'); /**DEFINE GLOBALS**/ define('STORE_XML_FILE' , 'catalog.xml'); /*FUNCTIONS*/ session_start(); function get_xml_catalog() { return new SimpleXMLElement(file_get_contents(STORE_XML_FILE)); } function get_shopping_cart() { if (! isset($_SESSION['cart'])) return new shoppingCart(); //starts new cart else return unserialize($_SESSION['Get']); } function set_shopping_cart($cart) { $_SESSION['cart'] = unserialize($cart); } function product_e
  23. Why am I getting this error? Fatal error: Class 'ShoppingCart' not found in D:\Hosting\5246561\html\functions.php on line 17 functions.php <?php require_once('classes/shoppingCart.php'); /**DEFINE GLOBALS**/ define('STORE_XML_FILE' , 'catalog.xml'); /*FUNCTIONS*/ function get_xml_catalog() { return new SimpleXMLElement(file_get_contents(STORE_XML_FILE)); } function get_shopping_cart() { if (! isset($_SESSION['cart'])) return new ShoppingCart(); //starts new cart else return unserialize($_SESSION['Get']); } function set_shopping_cart($cart)
  24. that worked! Thank you so much!
  25. still not working error Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: <img alt "Bo's Peanut Butter Chunchies" src= "http://auntievics.com/assets/Chu'>http://auntievics.com/assets/Chu'>http://auntievics.com/assets/Chu in D:\Hosting\5246561\html\functions.php on line 9 Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: ^ in D:\Hosting\5246561\html\functions.php on line 9 Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: Entity: line 16: parser error : attributes construct error in D:\Hosting\5246561\h
×
×
  • Create New...