Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2018
    Location
    UK
    Posts
    26
    Plugin Contributions
    3

    Idea or Suggestion persistent error pzen_ajax_compare.php

    1.5.5f

    i keep getting a persistant error pzen_ajax_compare.php on line 27

    PHP Warning: Invalid argument supplied for foreach() in C:\inetpub\Vapeshop.me.uk\pzen_ajax_compare.php on line 27

    Code:
    13         require('includes/application_top.php');
    14        require(DIR_WS_MODULES . 'require_languages.php');
    15         // get values
    16         $action = $_POST['com_action'];
    17         $selected = $_POST['compare_id'];
    18         $compare_array = array();
    19         $comp_images = '';
    20         $compare_warning = '';
    21         $comp_value_count = count($_SESSION['compare']);
    22         // add new products selected
    23         if ($action == 'add') {
    24         if ($comp_value_count < COMPARE_VALUE_COUNT) {
    25         $compare_array[] = $selected;
    26         foreach ($_SESSION['compare'] as $c) {
    27            if ($c != $selected) {
    28                $compare_array[] = $c;
    29            }
    30        }
    31        $_SESSION['compare'] = array_unique($compare_array);
    32		$compare_warning = COMPARE_PRODUCTS_ADDED;
    33    } else {
    34        $compare_warning = COMPARE_ONETIME_ITEM_COMPARE;
    35    }
    36  }
    can anyone see whats wrong ?????????????????????

  2. #2
    Join Date
    Jul 2012
    Posts
    16,733
    Plugin Contributions
    17

    Default Re: persistent error pzen_ajax_compare.php

    Well, not 100% sure, but am wondering what existing values are present for the session variable for one, two is if some other variable should get set to what the session holds, and lastly it doesn't appear that anything special is done if there are no values for the session variable already assigned. What php version is being used?
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,690
    Plugin Contributions
    123

    Default Re: persistent error pzen_ajax_compare.php

    Before the foreach statement add this:

    if ((!isset($_SESSION['compare'])) || (!is_array($_SESSION['compare']))) $_SESSION['compare'] = array();
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  4. #4
    Join Date
    Oct 2018
    Location
    UK
    Posts
    26
    Plugin Contributions
    3

    Default Re: persistent error pzen_ajax_compare.php

    Thank you

 

 

Similar Threads

  1. Replies: 3
    Last Post: 13 Mar 2009, 05:20 PM
  2. Persistent login?
    By MidnightLich in forum General Questions
    Replies: 3
    Last Post: 10 Jul 2007, 01:04 AM
  3. persistent connections
    By kgchis in forum General Questions
    Replies: 1
    Last Post: 22 May 2006, 08:53 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR