Talk:Errors

From Zen Cart(tm) Wiki
Jump to: navigation, search

New page - comments?

I made this page to suggest that we need something like this.
Any suggestions regarding which category it fits best into, or perhaps how the page should be layed out?

Perhaps we need a "Troubleshooting" category too?

Warning: Variable passed to each() is not an array or object in ... includes/application_top.php on line 682

In case things are unclear, the suggested fix deals with 2 related bugs.

Step 1 and 3 deals with one bug, and step 2 deals with another.

$how_many is according to my suggested fix not enclosed within an if statement because as far as I can see there's no reason it shouldn't be initialised, and IMO it's not a good idea to use an unitialised variable. ;-)

The if statement and form output is moved to the bottom of the file, after $how_many has been created so we can see if we're supposed to draw the form or not. That was one bug.

The other bug was displaying "Add selected products to cart" buttons where they shouldn't be displayed. $how_many is now incremented only if the product can be added to cart from the "multiple add to cart"-form.

Hope that helps.

--Dwno 15:08, 4 January 2006 (MST)

hi,

I have been working for the last couple of months with full error reporting turned on, in order to catch places where variables are not initilaised. I agree it is a bad thing (lots of stuff in legacy code, and new stuff as well)

However I think ther is a problem with the instructions

  1. Open includes/modules/product_listing.php
    1. Replace
        if (PRODUCT_LISTING_MULTIPLE_ADD_TO_CART != 0 and $show_submit == 'true' and $listing_split->number_of_rows > 0) {
   // bof: multiple products
   $how_many = 0;
   echo zen_draw_form('multiple_products_cart_quantity', zen_href_link(zen_get_info_page($_GET['products_id']), zen_get_all_get_params(array('action')) . 'action=multiple_products_add_product'), 'post', 'enctype="multipart/form-data"');
}with
    $how_many = 0;


This suggest replacing the whole code block . should no the replacement be

      $how_many = 0;
   if (PRODUCT_LISTING_MULTIPLE_ADD_TO_CART != 0 and $show_submit == 'true' and $listing_split->number_of_rows > 0) {
    // bof: multiple products
    echo zen_draw_form('multiple_products_cart_quantity', zen_href_link(zen_get_info_page($_GET['products_id']), zen_get_all_get_params(array('action')) . 'action=multiple_products_add_product'), 'post', 'enctype="multipart/form-data"');
  }
The code you quoted is actually just moved to the end of the file, after $how_many has been counted so it can be used to check if the form should be drawn or not. ;-) I might add that the form should not be created if there are no products that can be added to cart through the multiple_products_cart_quantity form. --Dwno 11:54, 7 January 2006 (MST)

Error codes in MySQL

To find out what an error code from MySQL means, you can execute 'perror <error code>' from the shell/command line.

For example, executing 'perror 145' returns

MySQL error code 145: Table was marked as crashed and should be repaired

Dwno 19:12, 14 March 2006 (EST)