Quote Originally Posted by linuxguy2 View Post
MC12345678
I resolved all the other issues but do have one more warning I'd like to get rid of.
The cart functions Ok but if I click "Add Multiple to Cart" without selecting a product I get the warning shown at the end of this post. I guess "products_id2" always expects a value.
Good news is No products are added.

Line 2092 in shopping_cart.php below is highlighted in red.

This warning occurrs with or without the 'true' mod in
Code:
home/pcs/public_html/19/includes/modules/product_listing.php  

if ((PRODUCT_LISTING_CHECKBOX_TEXTBOX_ACTIVE == true)) {
        echo zen_draw_hidden_field('check_text_active', 'true'); 
    }
	/*End mc12345678 Added for checkbox/textbox Plug-In */
home/pcs/public_html/19/includes/classes/shopping_cart.php
Code:
   * Method to handle cart Action - multiple add products
   *
   * @param string forward destination
   * @param url parameters
   * @todo change while loop to a foreach
   */
  function actionMultipleAddProduct($goto, $parameters) {
    global $messageStack;
    if ($this->display_debug_messages) $messageStack->add_session('header', 'FUNCTION ' . __FUNCTION__, 'caution');

    $addCount = 0;
    if (is_array($_POST['products_id']) && sizeof($_POST['products_id']) > 0) {

    // Begin mc12345678 Checkbox/TextBox 1 of 2
      if ($_POST['check_text_active'] == true) {
        $multiAddCheck = true;
      } else {
        $multiAddCheck = false;
      }
      // End mc12345678 Checkbox/TextBox 1 of 2

//echo '<pre>'; echo var_dump($_POST['products_id']); echo '</pre>';
      $products_list = $_POST['products_id'];
      foreach($products_list as $key => $val) {
        $prodId = preg_replace('/[^0-9a-f:.]/', '', $key);

        // Begin mc12345678 Checkbox/TextBox 2 of 2
        if (
            (
              defined('PRODUCT_ALL_CHECKBOX_TEXTBOX_ACTIVE') && PRODUCT_ALL_CHECKBOX_TEXTBOX_ACTIVE == '1'
              || defined('PRODUCT_FEATURED_CHECKBOX_TEXTBOX_ACTIVE') && PRODUCT_FEATURED_CHECKBOX_TEXTBOX_ACTIVE == '1'
              || defined('PRODUCT_NEW_CHECKBOX_TEXTBOX_ACTIVE') && PRODUCT_NEW_CHECKBOX_TEXTBOX_ACTIVE == '1'
              || defined('PRODUCT_LISTING_CHECKBOX_TEXTBOX_ACTIVE') && PRODUCT_LISTING_CHECKBOX_TEXTBOX_ACTIVE == '1'
             )
            && $multiAddCheck == true
            ) {
          
          foreach($_POST['products_id2'] as $key2 => $val2) {
            if ($key == $key2) {
              if (is_numeric($val) && $val > 0) 
              {
                $adjust_max = false;
                $qty = $val;
                $add_max = zen_get_products_quantity_order_max($prodId);
                $cart_qty = $this->in_cart_mixed($prodId);
                $new_qty = $this->adjust_quantity($qty, $prodId, 'shopping_cart');
                
                if (($add_max == 1 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));
                  $addCount++;
                }
                if ($adjust_max == 'true') {
                  if ($this->display_debug_messages) $messageStack->add_session('header', 'FUNCTION ' . __FUNCTION__ . '<br>' . ERROR_MAXIMUM_QTY . zen_get_products_name($prodId), 'caution');
                  $messageStack->add_session('shopping_cart', ERROR_MAXIMUM_QTY . zen_get_products_name($prodId), 'caution');
                }
              }
              break; /*Add product, otherwise don't add */ 
              
            }
          }
        } elseif (is_numeric($val) && $val > 0) {
          // End mc12345678 Checkbox/TextBox 2 of 2
        
          $adjust_max = false;
          $qty = $val;
          $add_max = zen_get_products_quantity_order_max($prodId);
          $cart_qty = $this->in_cart_mixed($prodId);
          $new_qty = $this->adjust_quantity($qty, $prodId, 'shopping_cart');
Warning:
Code:
[25-Feb-2019 17:35:18 UTC] Request URI: /19/index.php?main_page=index&cPath=5&sort=20a&action=multiple_products_add_product, IP address: 76.182.229.147
#1  shoppingCart->actionMultipleAddProduct() called at [/home/pcs/public_html/19/includes/main_cart_actions.php:55]
#2  require(/home/pcs/public_html/19/includes/main_cart_actions.php) called at [/home/pcs/public_html/19/includes/init_includes/init_cart_handler.php:44]
#3  require(/home/pcs/public_html/19/includes/init_includes/init_cart_handler.php) called at [/home/pcs/public_html/19/includes/autoload_func.php:48]
#4  require(/home/pc/public_html/19/includes/autoload_func.php) called at [/home/pcs/public_html/19/includes/application_top.php:170]
#5  require(/home/pcs/public_html/19/includes/application_top.php) called at [/home/pcs/public_html/19/index.php:26]
--> PHP Warning: Invalid argument supplied for foreach() in /home/pcs/public_html/19/includes/classes/shopping_cart.php on line 2092.
Change this portion from:
Code:
       // Begin mc12345678 Checkbox/TextBox 2 of 2
        if (
            (
              defined('PRODUCT_ALL_CHECKBOX_TEXTBOX_ACTIVE') && PRODUCT_ALL_CHECKBOX_TEXTBOX_ACTIVE == '1'
              || defined('PRODUCT_FEATURED_CHECKBOX_TEXTBOX_ACTIVE') && PRODUCT_FEATURED_CHECKBOX_TEXTBOX_ACTIVE == '1'
              || defined('PRODUCT_NEW_CHECKBOX_TEXTBOX_ACTIVE') && PRODUCT_NEW_CHECKBOX_TEXTBOX_ACTIVE == '1'
              || defined('PRODUCT_LISTING_CHECKBOX_TEXTBOX_ACTIVE') && PRODUCT_LISTING_CHECKBOX_TEXTBOX_ACTIVE == '1'
             )
            && $multiAddCheck == true
            ) {
To:
Code:
       // Begin mc12345678 Checkbox/TextBox 2 of 2
        if (
            !empty($_POST['products_id2']) &&
            (
              defined('PRODUCT_ALL_CHECKBOX_TEXTBOX_ACTIVE') && PRODUCT_ALL_CHECKBOX_TEXTBOX_ACTIVE == '1'
              || defined('PRODUCT_FEATURED_CHECKBOX_TEXTBOX_ACTIVE') && PRODUCT_FEATURED_CHECKBOX_TEXTBOX_ACTIVE == '1'
              || defined('PRODUCT_NEW_CHECKBOX_TEXTBOX_ACTIVE') && PRODUCT_NEW_CHECKBOX_TEXTBOX_ACTIVE == '1'
              || defined('PRODUCT_LISTING_CHECKBOX_TEXTBOX_ACTIVE') && PRODUCT_LISTING_CHECKBOX_TEXTBOX_ACTIVE == '1'
             )
            && $multiAddCheck == true
            ) {