Jump to content

mshaynerush

New Members
  • Posts

    7
  • Joined

  • Last visited

mshaynerush's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. In the page, there was a drop down menu populated by state names that were then converted from actual state names to abbreviations. I moved that function from the actual page to the functions.inc.php file and then made a function call in place of where convert_state() function was. That fixed the problem. Boy what a pain this was. PHP was fine. I had been working on this site, mostly front end and some small PHP code here and there for years. It just now started doing all of this, but with your help here, I am proud and elated to announce that your help and Google, all errors are gone. Awesome! Thank you for your time and expertise in helping me out with this issue!
  2. Quick question. I have a cannot redeclare error now. It's like the site started falling apart. Anyway, is it necessary to unset a session to avoid this error?
  3. Yep. That did the trick. Thank you guys very much for you help.
  4. I have no way of doing that because I really don't know. Weeks ago, he was receiving orders and now he can't suddenly. I found some stuff about deprecated tags, changed out session_register for $_SESSION['cart]' and session_unregister with unset($_SESSION['cart']) and that removed the fatal errors. NOW all that happens is that the cart is empty. NO errors, but nothing is being added to the cart. this is my most recent, fatal error free code: <? ini_set('display_errors',1); ini_set('display_startup_errors',1); error_reporting(-1); require "./includes/cart_class.php"; require_once "./includes/functions.inc.php"; session_start(); //unset($_SESSION['cart']; //exit(); $product_id = $_REQUEST["pid"]; $pcid = $_REQUEST['pcid']; $product_name = $_REQUEST['product_name']; $price = $_REQUEST['price']; $qty = $_REQUEST['qty']; $att_id = $_REQUEST['att_id']; $att_value_id = $_REQUEST['att_value_id']; $pop = $_REQUEST["pop"]; /// if value =1 then comes from popup product details page. $page_type = $_REQUEST['page_type']; /// if value =1 then comes from category pages. $stoolH = $_REQUEST['stoolheight']; $arr_att = array($att_id, $att_value_id); $sql="select product_weight from yp_product where product_id='$product_id'"; $pweight=getSingleResult($sql); if($_SESSION['cart']!=""){ $cart=$_SESSION['cart']; } if($qty==''){ if($min_qty!=""){ $qty=$min_qty; }else{ $qty=1; } } if($qty==0){ $_SESSION['sess_msg']= "QUANTITY CANNOT BE LESS THAN 1"; header("Location: product_detail.php?pid=$pid&pcid=$pcid"); exit(); } if(!$_SESSION['cart']){ $cart = new cart(); $_SESSION['cart']; } $item_object = new product($product_id , $product_name , $price, $arr_att, $qty , $pweight, $stoolH); $cart->addToCart($item_object , $product_id , $product_name , $price , $arr_att , $qty , $stoolH , $pweight); $back="modify_cart_frm.php"; header("Location: ".$back); exit; ?>
  5. Thank you for that. this is the error i get after all that: Notice: Undefined index: att_id in /data/18/1/57/42/1220042/user/1300782/htdocs/add_to_cart.php on line 18 Notice: Undefined index: pop in /data/18/1/57/42/1220042/user/1300782/htdocs/add_to_cart.php on line 20 Notice: Undefined index: page_type in /data/18/1/57/42/1220042/user/1300782/htdocs/add_to_cart.php on line 21 Notice: Undefined index: stoolheight in /data/18/1/57/42/1220042/user/1300782/htdocs/add_to_cart.php on line 22 Notice: Undefined index: cart in /data/18/1/57/42/1220042/user/1300782/htdocs/add_to_cart.php on line 30 Deprecated: Function session_is_registered() is deprecated in /data/18/1/57/42/1220042/user/1300782/htdocs/add_to_cart.php on line 49 Deprecated: Function session_register() is deprecated in /data/18/1/57/42/1220042/user/1300782/htdocs/add_to_cart.php on line 51 object(cart)#1 (1) { ["cart"]=> array(0) { } } Deprecated: Function session_unregister() is deprecated in /data/18/1/57/42/1220042/user/1300782/htdocs/includes/cart_class.php on line 211 Deprecated: Function session_register() is deprecated in /data/18/1/57/42/1220042/user/1300782/htdocs/includes/cart_class.php on line 213 Warning: Cannot modify header information - headers already sent by (output started at /data/18/1/57/42/1220042/user/1300782/htdocs/add_to_cart.php:51) in /data/18/1/57/42/1220042/user/1300782/htdocs/add_to_cart.php on line 60
  6. This is the error: Fatal error: Call to a member function addToCart() on a non-object in /data/18/1/57/42/1220042/user/1300782/htdocs/add_to_cart.php on line 50
  7. <code> <? require "./includes/cart_class.php"; require_once "./includes/functions.inc.php"; session_start(); //session_unregister('cart'); //exit(); $product_id = $_POST["pid"]; $pcid = $_POST["pcid"]; $product_name = $_POST["product_name"]; $price = $_POST["price"]; $qty = $_POST["qty"]; $att_id = $_POST["att_id"]; $att_value_id = $_POST["att_value_id"]; $pop = $_POST['pop']; /// if value =1 then comes from popup product details page. $page_type = $_POST['page_type']; /// if value =1 then comes from category pages. $stoolH = $_POST["stoolheight"]; $arr_att = array($att_id, $att_value_id); $sql="select product_weight from yp_product where product_id='$product_id'"; $pweight=getSingleResult($sql); if($_SESSION['cart']!=""){ $cart=$_SESSION['cart']; } if($qty==''){ if($min_qty!=""){ $qty=$min_qty; }else{ $qty=1; } } if($qty==0){ $_SESSION['sess_msg']= "QUANTITY CANNOT BE LESS THAN 1"; header("Location: product_detail.php?pid=$pid&pcid=$pcid"); exit(); } if(!session_is_registered('cart')){ $cart = new cart(); session_register('cart'); } $item_object = new product($product_id , $product_name , $price, $arr_att, $qty , $pweight, $stoolH); $cart->addToCart($item_object); $back="modify_cart_frm.php"; header("Location: ".$back); exit; ?> </code> it gives a fatal error. Problem started a week or two ago, but the code hasn't changed to my knowledge. I did not write this.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.