Page 5 of 5 FirstFirst ... 345
Results 41 to 49 of 49
  1. #41
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Support Thread: Checkbox Textbox Icon Addon for Listings

    linuxguy2:

    Here is the newly generated shopping_cart class method to support this plugin... I haven't tested it, but the code looks right The two modifications are commented:
    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');
    
    // bof: adjust new quantity to be same as current in stock
              $chk_current_qty = zen_get_products_stock($prodId);
              if (STOCK_ALLOW_CHECKOUT == 'false' && ($new_qty > $chk_current_qty)) {
                  $new_qty = $chk_current_qty;
                  $messageStack->add_session('shopping_cart', ($this->display_debug_messages ? 'FUNCTION ' . __FUNCTION__ . ': ' : '') . WARNING_PRODUCT_QUANTITY_ADJUSTED . zen_get_products_name($prodId), 'caution');
              }
    // eof: adjust new quantity to be same as current in stock
    
              if (($add_max == 1 and $cart_qty == 1)) {
                // do not add
                $adjust_max= 'true';
              } else {
    // bof: adjust new quantity to be same as current in stock
                if (STOCK_ALLOW_CHECKOUT == 'false' && ($new_qty + $cart_qty > $chk_current_qty)) {
                    $adjust_new_qty = 'true';
                    $alter_qty = $chk_current_qty - $cart_qty;
                    $new_qty = ($alter_qty > 0 ? $alter_qty : 0);
                    $messageStack->add_session('shopping_cart', ($this->display_debug_messages ? 'FUNCTION ' . __FUNCTION__ . ': ' : '') . WARNING_PRODUCT_QUANTITY_ADJUSTED . zen_get_products_name($prodId), 'caution');
                }
    // eof: adjust new quantity to be same as current in stock
                // 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');
              }
            }
            if (!is_numeric($val) || $val < 0) {
              // adjust quantity when not a value
              $chk_link = '<a href="' . zen_href_link(zen_get_info_page($prodId), 'cPath=' . (zen_get_generated_category_path_rev(zen_get_products_category_id($prodId))) . '&products_id=' . $prodId) . '">' . zen_get_products_name($prodId) . '</a>';
              $messageStack->add_session('header', ERROR_CORRECTIONS_HEADING . ERROR_PRODUCT_QUANTITY_UNITS_SHOPPING_CART . $chk_link . ' ' . PRODUCTS_ORDER_QTY_TEXT . zen_output_string_protected($val), 'caution');
              $val = 0;
            }
          }
    // display message if all is good and not on shopping_cart page
          if (($addCount && DISPLAY_CART == 'false' && $_GET['main_page'] != FILENAME_SHOPPING_CART) && $messageStack->size('shopping_cart') == 0) {
            $messageStack->add_session('header', ($this->display_debug_messages ? 'FUNCTION ' . __FUNCTION__ . ': ' : '') . SUCCESS_ADDED_TO_CART_PRODUCTS, 'success');
          } else {
            if (DISPLAY_CART == 'false') {
              zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
            }
          }
          zen_redirect(zen_href_link($goto, zen_get_all_get_params($parameters)));
        }
      }
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  2. #42
    Join Date
    Sep 2013
    Location
    Texas
    Posts
    304
    Plugin Contributions
    0

    Default Re: Support Thread: Checkbox Textbox Icon Addon for Listings

    Quote Originally Posted by mc12345678 View Post
    linuxguy2:

    Here is the newly generated shopping_cart class method to support this plugin... I haven't tested it, but the code looks right The two modifications are commented:
    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');
    
    // bof: adjust new quantity to be same as current in stock
              $chk_current_qty = zen_get_products_stock($prodId);
              if (STOCK_ALLOW_CHECKOUT == 'false' && ($new_qty > $chk_current_qty)) {
                  $new_qty = $chk_current_qty;
                  $messageStack->add_session('shopping_cart', ($this->display_debug_messages ? 'FUNCTION ' . __FUNCTION__ . ': ' : '') . WARNING_PRODUCT_QUANTITY_ADJUSTED . zen_get_products_name($prodId), 'caution');
              }
    // eof: adjust new quantity to be same as current in stock
    
              if (($add_max == 1 and $cart_qty == 1)) {
                // do not add
                $adjust_max= 'true';
              } else {
    // bof: adjust new quantity to be same as current in stock
                if (STOCK_ALLOW_CHECKOUT == 'false' && ($new_qty + $cart_qty > $chk_current_qty)) {
                    $adjust_new_qty = 'true';
                    $alter_qty = $chk_current_qty - $cart_qty;
                    $new_qty = ($alter_qty > 0 ? $alter_qty : 0);
                    $messageStack->add_session('shopping_cart', ($this->display_debug_messages ? 'FUNCTION ' . __FUNCTION__ . ': ' : '') . WARNING_PRODUCT_QUANTITY_ADJUSTED . zen_get_products_name($prodId), 'caution');
                }
    // eof: adjust new quantity to be same as current in stock
                // 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');
              }
            }
            if (!is_numeric($val) || $val < 0) {
              // adjust quantity when not a value
              $chk_link = '<a href="' . zen_href_link(zen_get_info_page($prodId), 'cPath=' . (zen_get_generated_category_path_rev(zen_get_products_category_id($prodId))) . '&products_id=' . $prodId) . '">' . zen_get_products_name($prodId) . '</a>';
              $messageStack->add_session('header', ERROR_CORRECTIONS_HEADING . ERROR_PRODUCT_QUANTITY_UNITS_SHOPPING_CART . $chk_link . ' ' . PRODUCTS_ORDER_QTY_TEXT . zen_output_string_protected($val), 'caution');
              $val = 0;
            }
          }
    // display message if all is good and not on shopping_cart page
          if (($addCount && DISPLAY_CART == 'false' && $_GET['main_page'] != FILENAME_SHOPPING_CART) && $messageStack->size('shopping_cart') == 0) {
            $messageStack->add_session('header', ($this->display_debug_messages ? 'FUNCTION ' . __FUNCTION__ . ': ' : '') . SUCCESS_ADDED_TO_CART_PRODUCTS, 'success');
          } else {
            if (DISPLAY_CART == 'false') {
              zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
            }
          }
          zen_redirect(zen_href_link($goto, zen_get_all_get_params($parameters)));
        }
      }
    Thanks, I'll check it out later today or tomorrow.

  3. #43
    Join Date
    Sep 2013
    Location
    Texas
    Posts
    304
    Plugin Contributions
    0

    Default Re: Support Thread: Checkbox Textbox Icon Addon for Listings

    Quote Originally Posted by linuxguy2 View Post
    Thanks, I'll check it out later today or tomorrow.
    zen-cart-v1.5.6-12102018 (Responsive_classic)
    Apache Version 2.4.34
    PHP Version 7.1
    MySQL Version 10.2.18-MariaDB
    Plugins:
    ColumnGridLayout_for_155f
    CheckBoxTextBoxIconV1.0.3 (modified)
    one_page_checkout-2.0.5
    extra_field_on_customer_sign_up_0
    purchase_order_basic_v1_1b
    EasyPopulate-4.master-ZC

    mc12345678,

    Merged with ZC v1.5.6 shopping_cart class code and works with this Warning.
    (same Warning with PHP 7.2)

    Code:
    [01-Jan-2019 19:25:21 UTC] PHP Warning:  Invalid argument supplied for foreach() in /home/pcsnnets/public_html/tp156/includes/classes/shopping_cart.php on line 2082
    CODE AT 2082:  foreach($_POST['products_id2'] as $key2 => $val2) {
    Does appear to have removed the (true) vs. ('true') workaround required in post on 8 Oct 2018, 08:20 PM.
    Will test further.

    Thank You Very Much for your time and expertise!

    Should I create a new thread elsewhere of my post of 13 Nov 2018, 11:00 AM. (or should it be moved )

  4. #44
    Join Date
    Sep 2013
    Location
    Texas
    Posts
    304
    Plugin Contributions
    0

    Default Re: Support Thread: Checkbox Textbox Icon Addon for Listings

    Quote Originally Posted by linuxguy2 View Post
    zen-cart-v1.5.6-12102018 (Responsive_classic)
    Apache Version 2.4.34
    PHP Version 7.1
    MySQL Version 10.2.18-MariaDB
    Plugins:
    ColumnGridLayout_for_155f
    CheckBoxTextBoxIconV1.0.3 (modified)
    one_page_checkout-2.0.5
    extra_field_on_customer_sign_up_0
    purchase_order_basic_v1_1b
    EasyPopulate-4.master-ZC

    mc12345678,

    Merged with ZC v1.5.6 shopping_cart class code and works with this Warning.
    (same Warning with PHP 7.2)

    Code:
    [01-Jan-2019 19:25:21 UTC] PHP Warning:  Invalid argument supplied for foreach() in /home/pcsnnets/public_html/tp156/includes/classes/shopping_cart.php on line 2082
    CODE AT 2082:  foreach($_POST['products_id2'] as $key2 => $val2) {
    Does appear to have removed the (true) vs. ('true') workaround required in post on 8 Oct 2018, 08:20 PM.
    Will test further.

    Thank You Very Much for your time and expertise!

    Should I create a new thread elsewhere of my post of 13 Nov 2018, 11:00 AM. (or should it be moved )
    Link to merged file:
    linuxguy2.com/ShoppingCart.html

  5. #45
    Join Date
    Sep 2013
    Location
    Texas
    Posts
    304
    Plugin Contributions
    0

    Default Re: Support Thread: Checkbox Textbox Icon Addon for Listings

    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.

  6. #46
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Support Thread: Checkbox Textbox Icon Addon for Listings

    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
                ) {
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  7. #47
    Join Date
    Sep 2013
    Location
    Texas
    Posts
    304
    Plugin Contributions
    0

    Default Re: Support Thread: Checkbox Textbox Icon Addon for Listings

    Quote Originally Posted by mc12345678 View Post
    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
                ) {
    That tweak causes the old problem where it adds everything in the product listing whether its' checked or unchecked.
    Tested switching the 'true' to true in "product_listing.php" but no joy.
    BTW
    Here's my Admin settings
    Code:
    Display Product Add to Cart Button (0=off; 1=on; 2=on with Qty Box per Product; 3=on with Adj per Product)	3
    Display Multiple Products Qty Box Status and Set Button Location	3 
    Display Check Box and Text Box for Checkout	1 
    Display Check Box for Checkout	0	
    Display Cart Quantity (0 - None, 1 - Greater than 0, 2 - Always)	0

  8. #48
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Support Thread: Checkbox Textbox Icon Addon for Listings

    Quote Originally Posted by mc12345678 View Post
    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
                ) {
    Quote Originally Posted by linuxguy2 View Post
    That tweak causes the old problem where it adds everything in the product listing whether its' checked or unchecked.
    Tested switching the 'true' to true in "product_listing.php" but no joy.
    BTW
    Here's my Admin settings
    Code:
    Display Product Add to Cart Button (0=off; 1=on; 2=on with Qty Box per Product; 3=on with Adj per Product)	3
    Display Multiple Products Qty Box Status and Set Button Location	3 
    Display Check Box and Text Box for Checkout	1 
    Display Check Box for Checkout	0	
    Display Cart Quantity (0 - None, 1 - Greater than 0, 2 - Always)	0
    I get it. Went a little too far back in the "correction". Then instead:
    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 (
                (
                  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
                ) {
                if (empty($_POST['products_id2'])) $_POST['products_id2'] = array();
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  9. #49
    Join Date
    Sep 2013
    Location
    Texas
    Posts
    304
    Plugin Contributions
    0

    Default Re: Support Thread: Checkbox Textbox Icon Addon for Listings

    Quote Originally Posted by mc12345678 View Post
    I get it. Went a little too far back in the "correction". Then instead:
    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 (
                (
                  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
                ) {
                if (empty($_POST['products_id2'])) $_POST['products_id2'] = array();
    Tested and it now appears to work properly!

    Many Thanks for your time and expertise!

 

 
Page 5 of 5 FirstFirst ... 345

Similar Threads

  1. Zen Lightbox addon [Support Thread]
    By Alex Clarke in forum All Other Contributions/Addons
    Replies: 3720
    Last Post: 6 Oct 2022, 11:18 PM
  2. Free Shipping Rules addon [Support Thread]
    By numinix in forum Addon Shipping Modules
    Replies: 36
    Last Post: 2 Dec 2016, 01:56 PM
  3. v151 Reviews Reply addon [Support Thread]
    By mikestaps in forum All Other Contributions/Addons
    Replies: 9
    Last Post: 17 Oct 2014, 01:29 AM
  4. v151 Admin Master-Categories Link Icon addon [support thread]
    By gjh42 in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 18 Oct 2012, 08:07 PM
  5. File Upload Required addon [Support Thread]
    By 1100101 in forum All Other Contributions/Addons
    Replies: 21
    Last Post: 10 Dec 2011, 03:00 AM

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