Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Join Date
    Jan 2015
    Posts
    278
    Plugin Contributions
    0

    Default Upgrade notice [FEC]Parameter must be an array or an object that implements Countable

    Zencart 1.5.7
    Php 7.4

    I am currently in the upgrade process from 5.6 to 5.7.

    I use FEC fast and easy checkout. I cant seem to solve this error. If some could help that would be great.


    Error
    HTML Code:
    --> PHP Warning: sizeof(): Parameter must be an array or an object that implements Countable in C:\xampp\htdocs\xxxxxx.com\includes\templates\theme871\templates\tpl_checkout_stacked.php on line 313.
    This is the line of code on line 313. This is where i am getting confused. I am not sure how to make the changes.

    Code:
    else {
    for ($j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++) {
    this is just the full piece of code in case i missed something
    Code:
     <?php }
    
                                  else {
    
                                      for ($j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++) {
    
                                      // set the radio button to be checked if it is the method chosen
    
                                          $checked = (($quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'] == $_SESSION['shipping']['id']) ? true : false);
    
    
                                          if ( ($checked == true) || ($n == 1 && $n2 == 1) ) {
    
                                              //echo '      <div id="defaultSelected" class="moduleRowSelected">' . "\n";
    
                                          //} else {
    
                                              //echo '      <div class="moduleRow">' . "\n";
    
                                          }
    
                                  ?>
    
                              <?php

  2. #2
    Join Date
    Jul 2012
    Posts
    15,178
    Plugin Contributions
    17

    Default Re: Upgrade Question - Parameter must be an array or an object that implements Counta

    Need code prior to that as '$quotes[$i]['methods']' is not "properly" set to be an array or something "countable"... It could be that it isn't set at all, but wouldn't really know unless the earlier code were reviewed...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...
    Upgraded to Zen Cart V1.5.3 from V1.5.1 from V1.5.0 from V1.3.9h

  3. #3
    Join Date
    Jan 2015
    Posts
    278
    Plugin Contributions
    0

    Default Re: Upgrade Question - Parameter must be an array or an object that implements Counta

    hopefully this helps

    Code:
     <?php
    
          
    
    if (FEC_SPLIT_CHECKOUT == 'true') {
    
        $splitColumns = "split-column";
    
    }
    
    ?>
    
    
    
    <div class="fec-container">
    
      <ul class="checkout-columns">
    
      	<li class="checkout-leftcolumn <?php echo $splitColumns; ?>">
    
      		<!-- BOF SHOPPING CART -->
    
      <?php
    
          
    
          if (FEC_SPLIT_CHECKOUT == 'true') {
    
              $selectionStyle = ($numselection%2 == 0 ? 'split' : '');
    
          }
    
      ?>
    
    
      <div id="checkoutOrderForm" class="fec-block-checkout <?php echo $checkoutStyle; ?>">
    
          <fieldset class="fec-table-items fec-fieldset" id="checkoutShoppingCart">
    
              <legend><?php echo TABLE_HEADING_SHOPPING_CART; ?></legend>
    
              <!-- <span class="fec-fieldset-legend"><?php echo TABLE_HEADING_SHOPPING_CART; ?></span> -->
    
              
    
              <div class="buttonRow forward fec-edit-button" id="editButton"><?php echo '<a href="' . zen_href_link(FILENAME_SHOPPING_CART, '', 'SSL') . '">' . zen_image_button(BUTTON_IMAGE_EDIT_SMALL, BUTTON_EDIT_SMALL_ALT) . '</a>'; ?></div>
    
              
    
              <?php 
    
                  if ($flagAnyOutOfStock) {
    
              ?>
    
                  <?php
    
                      if (STOCK_ALLOW_CHECKOUT == 'true') {
    
                  ?>
    
                          <div class="messageStackError"><?php echo OUT_OF_STOCK_CAN_CHECKOUT; ?></div>
    
                  <?php }
    
                      else {
    
                  ?>
    
                          <div class="messageStackError"><?php echo OUT_OF_STOCK_CANT_CHECKOUT; ?></div>
    
                  <?php } //endif STOCK_ALLOW_CHECKOUT ?>
    
              <?php  } //endif flagAnyOutOfStock ?>
    
                    
    
              <table id="cartContentsDisplay">
    
    
                  <tr class="cartTableHeading">
    
                      <th scope="col" id="ccQuantityHeading"><?php echo TABLE_HEADING_QUANTITY; ?></th>
    
                      <th scope="col" id="ccProductsHeading" colspan="3"><?php echo TABLE_HEADING_PRODUCTS; ?></th>
    
                      <th scope="col" id="ccTotalHeading"><?php echo TABLE_HEADING_TOTAL; ?></th>
    
                  </tr>
    
    
                  <?php // now loop thru all products to display quantity and price ?>
    
                  <?php for ($i=0, $n=sizeof($order->products); $i<$n; $i++) { ?>
    
                        <?php $thumbnail = zen_get_products_image($order->products[$i]['id'], 40, 42); ?>
    
                        <tr class="<?php echo $order->products[$i]['rowClass']; ?>">
    
                            
    
                            <td class="cartQuantity"><?php echo $order->products[$i]['qty']; ?>&nbsp;x</td>
    
                            <td class="cartImage"><?php echo $thumbnail; ?></td>
    
                            <td class="cartProductDisplay" colspan="2"><?php echo $order->products[$i]['name']; ?>
    
                                <?php  echo $stock_check[$i]; ?>
    
                                
    
                                <?php // if there are attributes, loop thru them and display one per line
    
                                    if (isset($order->products[$i]['attributes']) && sizeof($order->products[$i]['attributes']) > 0 ) {
    
                                    echo '<ul class="cartAttribsList">';
    
                                      for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
    
                                ?>
    
                                      <li><?php echo $order->products[$i]['attributes'][$j]['option'] . ': ' . nl2br(zen_output_string_protected($order->products[$i]['attributes'][$j]['value'])); ?></li>
    
                                <?php
    
                                      } // end loop
    
                                      echo '</ul>';
    
                                    } // endif attribute-info
    
                                ?>
    
                            </td>
    
                            <td class="cartTotalDisplay">
    
                                <?php echo $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']);
    
                                    if ($order->products[$i]['onetime_charges'] != 0 ) echo '<br /> ' . $currencies->display_price($order->products[$i]['onetime_charges'], $order->products[$i]['tax'], 1);
    
                                ?>
    
                            </td>
    
    
                        </tr>
    
                    <?php  }  // end for loopthru all products 
    
                    ?>   
    
              </table>
    
                    
    
              <?php
    
                  if (MODULE_ORDER_TOTAL_INSTALLED) {
    
                      $order_totals = $order_total_modules->process();
    
              ?>
    
                    <div id="orderTotals"><?php $order_total_modules->output(); ?></div>
    
              <?php } ?>
    
          </fieldset>
    
      </div>
    
      <!-- EOF SHOPPING CART -->
    
    
      <!--BOF SHIPPING-->
    
    
    <?php
    
        if ($order->content_type != 'virtual') {
    
    ?>
    
            <div id="checkoutShippingForm" class="fec-block-checkout align321 <?php echo $checkoutStyle; ?>">
    
    
                <!-- <h1 id="checkoutShippingHeading"><?php echo HEADING_TITLE_SHIPPING; ?></h1> -->
    
                
    
                <fieldset class="fec-shipping-methods fec-fieldset" id="checkoutShippingMethods">
    
                    <legend><?php echo TABLE_HEADING_SHIPPING_METHOD; ?></legend>
    
                    <span class="fec-fieldset-legend"><?php echo TABLE_HEADING_SHIPPING_METHOD; ?></span>
    
                
    
                    <fieldset class="fec-shipping-to fec-shipping-address fec-fieldset" id="checkoutShipTo">
    
                        <legend><?php echo TABLE_HEADING_SHIPPING_ADDRESS; ?></legend>
    
                        <span class="fec-fieldset-legend-two"><?php echo TABLE_HEADING_SHIPPING_ADDRESS; ?></span>
    
                
    
                        <?php if ($messageStack->size('checkout_shipping') > 0) echo $messageStack->output('checkout_shipping'); ?>  
    
                        <div class="fec-address-container">
    
                            <div id="checkoutShipto">
    
                                <address class="checkoutAddress"><?php echo html_entity_decode(zen_address_label($_SESSION['customer_id'], $_SESSION['sendto'], true, ' ', '<br />')); ?></address>
    
                            </div> 
    
                            <?php if ($displayAddressEdit) { ?>
    
                                <?php 
    
                                    echo '<a id="linkCheckoutShippingAddr" class="cssButton normal_button button  button_change_address" href="' . zen_href_link(FILENAME_CHECKOUT_SHIPPING_ADDRESS, '', 'SSL') . '">' . zen_image_button(BUTTON_IMAGE_CHANGE_ADDRESS, BUTTON_CHANGE_ADDRESS_ALT) . '</a>';
    
                                ?>
    
                            <?php } ?>
    
                        </div>
    
                    </fieldset>
    
          <?php
    
            //$addresses_count = zen_count_customer_address_book_entries();
    
            //require($template->get_template_dir('tpl_modules_fec_change_checkout_shipping_address.php', DIR_WS_TEMPLATE, $current_page_base,'templates/fec'). '/' . 'tpl_modules_fec_change_checkout_shipping_address.php');
    
          ?>
    
    
      <?php
    
          if (zen_count_shipping_modules() > 0) {
    
      ?>
    
              
    
                    <span class="fec-fieldset-legend-two"><?php echo TABLE_SUBHEADING_SHIPPING_METHOD; ?></span>
    
    
              <?php
    
                  if (sizeof($quotes) > 1 && sizeof($quotes[0]) > 1) {
    
              ?>
    
                      <!-- <div id="checkoutShippingContentChoose" class="fec-information"><?php echo TEXT_CHOOSE_SHIPPING_METHOD; ?></div> -->
    
              <?php } 
    
                  elseif ($free_shipping == false) {
    
              ?>
    
                      <!-- <div id="checkoutShippingContentChoose" class="fec-information"><?php echo TEXT_ENTER_SHIPPING_INFORMATION; ?></div> -->
    
    
              <?php
    
                  }
    
              ?>
    
              <?php
    
                  if ($free_shipping == true) {
    
              ?>
    
                      <div id="freeShip" class="fec-information" ><?php echo FREE_SHIPPING_TITLE; ?>&nbsp;<?php echo $quotes[$i]['icon']; ?></div>
    
                      <div id="defaultSelected"><?php echo sprintf(FREE_SHIPPING_DESCRIPTION, $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)) . zen_draw_hidden_field('shipping', 'free_free'); ?></div>
    
    
              <?php }
    
                  else {
    
                      $radio_buttons = 0;
    
                      for ($i=0, $n=sizeof($quotes); $i<$n; $i++) {
    
                  ?>
    
    
                          <div class="fec-shipping-method">
    
                              <span><?php echo $quotes[$i]['module']; ?>&nbsp;<?php if (isset($quotes[$i]['icon']) && zen_not_null($quotes[$i]['icon'])) { echo $quotes[$i]['icon']; } ?></span>
    
                              <?php
    
                                  if (isset($quotes[$i]['error'])) {
    
                              ?>  
    
                                      <div><?php echo $quotes[$i]['error']; ?></div>
    
                              <?php }
    
                                  else {
    
                                      for ($j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++) {
    
                                      // set the radio button to be checked if it is the method chosen
    
                                          $checked = (($quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'] == $_SESSION['shipping']['id']) ? true : false);
    
    
                                          if ( ($checked == true) || ($n == 1 && $n2 == 1) ) {
    
                                              //echo '      <div id="defaultSelected" class="moduleRowSelected">' . "\n";
    
                                          //} else {
    
                                              //echo '      <div class="moduleRow">' . "\n";
    
                                          }
    
                                  ?>
    
                              <?php
    
                  if ( ($n > 1) || ($n2 > 1) ) {
    
    
      ?>
    
                      <div class="important fec-shipping-value"><?php echo $currencies->format(zen_add_tax($quotes[$i]['methods'][$j]['cost'], (isset($quotes[$i]['tax']) ? $quotes[$i]['tax'] : 0))); ?></div>
    
      <?php
    
                  } else {
    
      ?>
    
                      <div class="important fec-shipping-value"><?php echo $currencies->format(zen_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])) . zen_draw_hidden_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id']); ?></div>
    
      <?php
    
                  }
    
      ?>
    
                
    
                  <div class="fec-box-check-radio">
    
                      <?php echo zen_draw_radio_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'], $checked, 'onclick="updateForm();" id="ship-'.$quotes[$i]['id'] . '-' . $quotes[$i]['methods'][$j]['id'].'"'); ?>
    
                      <label for="ship-<?php echo $quotes[$i]['id'] . '-' . $quotes[$i]['methods'][$j]['id']; ?>" class="checkboxLabel" ><?php echo $quotes[$i]['methods'][$j]['title']; ?></label>
    
                  </div>
    
      <!--</div>-->
    
      <?php
    
                  $radio_buttons++;
    
                }
    
                //bof tell a friend
    
                if($quotes[$i]["id"] == "tellafriend") {
    
                  echo MODULE_SHIPPING_TELL_A_FRIEND_TEXT_CUSTOMER;
    
                  echo $tell_a_friend_email_error != "" ? "<div class='messageStackWarning'>$tell_a_friend_email_error</div>" : "";
    
      ?>
    
                  <div class="tellAFriendContent" style="width:50%;"><strong>Email</strong></div>
    
                  <div class="tellAFriendContent" style="width:25%;"><strong>First Name</strong></div>
    
                  <div class="tellAFriendContent" style="width:25%;"><strong>Last Name</strong></div>
    
      <?php          
    
            for ($j = 0; $j < $quotes[$i]['email_no']; $j++) {
    
      ?>
    
                <div class="tellAFriendContent" style="width:50%;"><?php echo zen_draw_input_field('tell_a_friend_email[]', $_SESSION["tell_a_friend_email"][$j], 'size="28"'); ?></div>
    
                <div class="tellAFriendContent" style="width:25%;"><?php echo zen_draw_input_field('tell_a_friend_email_f_name[]', $_SESSION["tell_a_friend_email_f_name"][$j], 'size="15"'); ?></div>
    
                <div class="tellAFriendContent" style="width:25%;"><?php echo zen_draw_input_field('tell_a_friend_email_l_name[]', $_SESSION["tell_a_friend_email_l_name"][$j], 'size="15"'); ?></div>
    
    
      <?php
    
            }
    
      // BOF Captcha
    
      if(is_object($captcha)) {
    
      ?>
    
      <?php echo $captcha->img(); ?>
    
      <?php echo $captcha->redraw_button(BUTTON_IMAGE_CAPTCHA_REDRAW, BUTTON_IMAGE_CAPTCHA_REDRAW_ALT); ?>
    
      <br class="clearBoth" />
    
      <label for="captcha"><?php echo TITLE_CAPTCHA; ?></label>
    
      <?php echo $captcha->input_field('captcha', 'id="captcha"') . '&nbsp;<span class="alert">' . TEXT_CAPTCHA . '</span>'; ?>
    
      <br class="clearBoth" />
    
      <?php
    
      }
    
      // EOF Captcha          
    
                }
    
      //eof tell a friend
    
              }
    
      ?>
    
    
      </div>
      
      
    
      <?php
    
            }
    
          }
    
      ?>
    
    
      <?php
    
        } else {
    
      ?>
    
        <h2 id="checkoutShippingHeadingMethod"><?php echo TITLE_NO_SHIPPING_AVAILABLE; ?></h2>
    
        <div id="checkoutShippingContentChoose" class="important"><?php echo TEXT_NO_SHIPPING_AVAILABLE; ?></div>
    
      <?php
    
        }
    
      ?>
    
      </fieldset>
    
      </div>
    
      <?php
    
        }
    
      ?>
    
      <!--EOF SHIPPING-->
    Last edited by chadlly2003; 5 Jul 2020 at 06:58 AM.

  4. #4
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    9,676
    Plugin Contributions
    73

    Default Re: Upgrade Question - Parameter must be an array or an object that implements Counta

    Is that log always issued, or is it dependent on the elements in the cart or shipping-method chosen?

    For instance, a 'virtual' order has no delivery address and, starting with the zc156 base, neither does an order being shipped via the storepickup method.

  5. #5
    Join Date
    Jan 2015
    Posts
    278
    Plugin Contributions
    0

    Default Re: Upgrade Question - Parameter must be an array or an object that implements Counta

    I got a little lost here. If i understand your question correctly....

    1. The error is always issued once i get to the checkout page.

    2. The Shipping selects the cheapest method automatically prior to the page loading.
    (shipping module is ups_v2020_07_01)

  6. #6
    Join Date
    Jan 2015
    Posts
    278
    Plugin Contributions
    0

    Default Re: Upgrade Question - Parameter must be an array or an object that implements Counta

    anyone have any ideas on how to solve my initial issue.

  7. #7
    Join Date
    Dec 2009
    Location
    Amersfoort, The Netherlands
    Posts
    2,862
    Plugin Contributions
    25

    Default Re: Upgrade Question - Parameter must be an array or an object that implements Counta

    Quote Originally Posted by chadlly2003 View Post
    anyone have any ideas on how to solve my initial issue.
    Did you contact Numinix? As it is their plugin, it will probably be very easy for them to solve it permanently for everybody.

  8. #8
    Join Date
    Jul 2012
    Posts
    15,178
    Plugin Contributions
    17

    Default Re: Upgrade Question - Parameter must be an array or an object that implements Counta

    Don't know what it will fix/break, but at least execution shouldn't stop on the line if the following is added just before the for loop and just after the else line:
    Code:
    if (empty($quotes[$i]['methods'])) {
     $quotes[$i]['methods'] = array();
    Again, I don't really know what that will do to further operation/display of information, but it won't throw the same issue at that line. As suggested above/before, identifying what product and/or checkout is being performed helps to properly correct the issue/suggest at least one other path forwards.

    Also, just because the report for that line may be corrected, there may be an issue further downstream that causes the catalog side to respond the same, but generate a different set of debug contents...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...
    Upgraded to Zen Cart V1.5.3 from V1.5.1 from V1.5.0 from V1.3.9h

  9. #9
    Join Date
    Jul 2012
    Posts
    15,178
    Plugin Contributions
    17

    Default Re: Upgrade Question - Parameter must be an array or an object that implements Counta

    Shoot... I forgot to add/suggest a closing parentheses:

    Code:
    if (empty($quotes[$i]['methods'])) {
     $quotes[$i]['methods'] = array();
    }
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...
    Upgraded to Zen Cart V1.5.3 from V1.5.1 from V1.5.0 from V1.3.9h

  10. #10
    Join Date
    Jan 2015
    Posts
    278
    Plugin Contributions
    0

    Default Re: Upgrade Question - Parameter must be an array or an object that implements Counta

    where do i put that piece of code.

    Code:
    if (empty($quotes[$i]['methods'])) {
     $quotes[$i]['methods'] = array();
    }

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 7
    Last Post: 30 Dec 2019, 05:21 PM
  2. Replies: 3
    Last Post: 24 Dec 2019, 08:16 AM
  3. Replies: 11
    Last Post: 21 Dec 2018, 09:06 PM
  4. Replies: 7
    Last Post: 16 Dec 2018, 04:00 PM
  5. v154 PHP Warning: extract() expects parameter 1 to be array
    By JoeH in forum General Questions
    Replies: 2
    Last Post: 15 May 2018, 06:44 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