Results 1 to 10 of 10
  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 !!

  7. #7
    Join Date
    Jan 2004
    Posts
    66,445
    Plugin Contributions
    81

    Default Re: /includes/classes/shopping_cart.php

    Isaacola,

    Is this resolved ? If so, what was the solution?
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  8. #8
    Join Date
    Jan 2004
    Posts
    66,445
    Plugin Contributions
    81

    Default Re: /includes/classes/shopping_cart.php

    The teamzr1 posts akin to the problem reported above have been moved to their initial thread where more detailed discussion takes place, to keep details together:
    http://www.zen-cart.com/forum/showthread.php?t=73800
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

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

    Default Re: /includes/classes/shopping_cart.php

    Quote Originally Posted by DrByte View Post
    Isaacola,

    Is this resolved ? If so, what was the solution?
    Applying the code above seem to have solved the problem.

  10. #10
    Join Date
    Jan 2004
    Posts
    66,445
    Plugin Contributions
    81

    Default Re: /includes/classes/shopping_cart.php

    Thanks for the confirmation.
    We'll use this or some rendition of it to prevent spiders from triggering unwanted alerts.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

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