Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Feb 2004
    Location
    Georgia, USA
    Posts
    1,948
    Plugin Contributions
    0

    Default [Done 2.0.0] /includes/classes/shopping_cart.php

    I am not sure if this is a bug or not but the error below is filling up our error log like crazy. Our db was recently upgraded to MYSQL 5.0+ so I am not sure if this related.

    PHP Warning: Variable passed to each() is not an array or object in /var/www/html/includes/classes/shopping_cart.php on line 1708

    Line 1708 reads:
    PHP Code:
    while ( list( $key$val ) = each($_POST['products_id']) ) { 

  2. #2
    Join Date
    Jun 2003
    Posts
    33,721
    Plugin Contributions
    0

    Default Re: /includes/classes/shopping_cart.php

    What version of PHP is installed and what version of Zen Cart are you using?
    Please do not PM for support issues: a private solution doesn't benefit the community.

    Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

  3. #3
    Join Date
    Feb 2004
    Location
    Georgia, USA
    Posts
    1,948
    Plugin Contributions
    0

    Default Re: /includes/classes/shopping_cart.php

    Quote Originally Posted by Kim View Post
    What version of PHP is installed and what version of Zen Cart are you using?

    Zen Cart 1.3.7
    PHP Version: 5.2.0 (Zend: 2.2.0)
    Database: MySQL 5.0.27-standard

  4. #4
    Join Date
    Jun 2003
    Location
    Newcastle UK
    Posts
    2,930
    Plugin Contributions
    4

    Default Re: /includes/classes/shopping_cart.php

    its definitley nt anything to do with mysql 5.

    I have a vague suspicion that its something to do with spiders, but will play around with it to see if I can reproduce

  5. #5
    Join Date
    Feb 2004
    Location
    Georgia, USA
    Posts
    1,948
    Plugin Contributions
    0

    Default Re: /includes/classes/shopping_cart.php

    Quote Originally Posted by wilt View Post
    its definitley nt anything to do with mysql 5.

    I have a vague suspicion that its something to do with spiders, but will play around with it to see if I can reproduce

    Any updates? This error is still filling up our error_log

    [Sat May 12 16:48:13 2007] [error] PHP Warning: Variable passed to each() is not an array or object in /includes/classes/shopping_cart.php on line 1708


    Thanks!

  6. #6
    Join Date
    Jun 2003
    Location
    Newcastle UK
    Posts
    2,930
    Plugin Contributions
    4

    Default Re: /includes/classes/shopping_cart.php

    HI,

    I'm still convinced this is caused by a spider picking up on a posted url.

    Code has been committed to bug fix branch to try and address the problem.

    If you want to try and adjust your current code then you need to replace your current

    function actionMultipleAddProduct
    with

    PHP Code:
      function actionMultipleAddProduct($goto$parameters) {
        global 
    $messageStack;
        if (
    is_array($_POST['products_id']) && sizeof($_POST['products_id']) > 0) {
          while ( list( 
    $key$val ) = each($_POST['products_id']) ) {
            if (
    $val 0) {
              
    $adjust_max false;
              
    $prodId $key;
              
    $qty $val;
              
    $add_max zen_get_products_quantity_order_max($prodId);
              
    $cart_qty $this->in_cart_mixed($prodId);
    //        $new_qty = $qty;
    //echo 'I SEE actionMultipleAddProduct: ' . $prodId . '<br>';
              
    $new_qty $this->adjust_quantity($qty$prodId'shopping_cart');

              if ((
    $add_max == and $cart_qty == 1)) {
                
    // do not add
                
    $adjust_max'true';
              } else {
                
    // adjust quantity if needed
                
    if (($new_qty $cart_qty $add_max) and $add_max != 0) {
                  
    $adjust_max'true';
                  
    $new_qty $add_max $cart_qty;
                }
                
    $this->add_cart($prodId$this->get_quantity($prodId)+($new_qty));
              }
              if (
    $adjust_max == 'true') {
    //            $messageStack->add_session('shopping_cart', ERROR_MAXIMUM_QTY . ' C: - ' . zen_get_products_name($prodId), 'caution');
                
    $messageStack->add_session('shopping_cart'ERROR_MAXIMUM_QTY zen_get_products_name($prodId), 'caution');
              }
            }
          }
    // display message if all is good and not on shopping_cart page
          
    if (DISPLAY_CART == 'false' && $_GET['main_page'] != FILENAME_SHOPPING_CART) {
            
    $messageStack->add_session('header'SUCCESS_ADDED_TO_CART_PRODUCTS'success');
          }
          
    zen_redirect(zen_href_link($gotozen_get_all_get_params($parameters)));
        }
      } 
    Always ensure you back up files you are changing !!

 

 

Similar Threads

  1. v154 Docs index, includes/classes/shopping_cart.php, and CHANGES-714
    By llynix in forum Upgrading to 1.5.x
    Replies: 5
    Last Post: 12 Jan 2015, 08:32 PM
  2. Replies: 0
    Last Post: 10 Mar 2013, 11:11 PM
  3. Replies: 2
    Last Post: 10 Dec 2007, 09:48 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg