Tsuri Japan Posted September 5, 2008 Posted September 5, 2008 Sorry but I'm getting this error when I go to make a duplicate product: 1136 - Column count doesn't match value count at row 1 insert into products (products_quantity, products_model, products_image, products_price, products_cost, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('0', 'SL17-GLD', 'daiwaSL-17-A2.jpg', '2400.0000', now(), null, '50', '0', '0', '12') [TEP STOP] If you need the code from the categories.php I can supply it... I really hope I can get this fixed ASAP. I have so many products I have to add and I hate having to do it all by copy and paste. Thanks in advance, Nigel
Jan Zonjee Posted September 5, 2008 Posted September 5, 2008 Sorry but I'm getting this error when I go to make a duplicate product: 1136 - Column count doesn't match value count at row 1 insert into products (products_quantity, products_model, products_image, products_price, products_cost, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('0', 'SL17-GLD', 'daiwaSL-17-A2.jpg', '2400.0000', now(), null, '50', '0', '0', '12') products_cost is missing in the row of values. Since products_cost is not a standard osC column either there is an error in the contribution you used or you made an error adding it.
Tsuri Japan Posted September 6, 2008 Author Posted September 6, 2008 Yeah I guess it was from a contrib I did called Margin report.... But maybe I found the bad part of the code, can you tell if this looks ok? // BOF: More Pics 6 Added: , p.products_subimage1, p.products_subimage2, p.products_subimage3, p.products_subimage4, p.products_subimage5, p.products_subimage6 $product_query = tep_db_query("select pd.products_name, pd.products_description, pd.products_url, p.products_id, p.products_quantity, p.products_model, p.products_image, p.products_subimage1, p.products_subimage2, p.products_subimage3, p.products_subimage4, p.products_subimage5, p.products_subimage6, p.products_price, p.products_cost, p.products_weight, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'"); // EOF: More Pics 6 Or here: // BOF: More Pics 6 Added: , p.products_subimage1, p.products_subimage2, p.products_subimage3, p.products_subimage4, p.products_subimage5, p.products_subimage6 $product_query = tep_db_query("select pd.products_name, pd.products_description, pd.products_url, p.products_id, p.products_quantity, p.products_model, p.products_image, p.products_subimage1, p.products_subimage2, p.products_subimage3, p.products_subimage4, p.products_subimage5, p.products_subimage6, p.products_price, p.products_cost, p.products_weight, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'"); // EOF: More Pics 6
Jan Zonjee Posted September 6, 2008 Posted September 6, 2008 Yeah I guess it was from a contrib I did called Margin report.... But maybe I found the bad part of the code, can you tell if this looks ok? That is not the part that causes the error. You have to look at the part in categories.php that starts with: case 'copy_to_confirm': . This is around line 300 so pretty much in the top of the file.
Tsuri Japan Posted September 6, 2008 Author Posted September 6, 2008 That is not the part that causes the error. You have to look at the part in categories.php that starts with: case 'copy_to_confirm': . This is around line 300 so pretty much in the top of the file. I copied from that area down with some of the code: case 'copy_to_confirm': if (isset($HTTP_POST_VARS['products_id']) && isset($HTTP_POST_VARS['categories_id'])) { $products_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']); $categories_id = tep_db_prepare_input($HTTP_POST_VARS['categories_id']); if ($HTTP_POST_VARS['copy_as'] == 'link') { if ($categories_id != $current_category_id) { $check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$products_id . "' and categories_id = '" . (int)$categories_id . "'"); $check = tep_db_fetch_array($check_query); if ($check['total'] < '1') { tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$products_id . "', '" . (int)$categories_id . "')"); } } else { $messageStack->add_session(ERROR_CANNOT_LINK_TO_SAME_CATEGORY, 'error'); } } elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') { // BOF: More Pics 6 Added: , products_subimage1, products_subimage2, products_subimage3, products_subimage4, products_subimage5, products_subimage6 $product_query = tep_db_query("select products_quantity, products_model, products_image, products_subimage1, products_subimage2, products_subimage3, products_subimage4, products_subimage5, products_subimage6, products_price, products_cost, products_date_available, products_weight, products_tax_class_id, manufacturers_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); // EOF: More Pics 6 $product = tep_db_fetch_array($product_query); // BOF: More Pics 6 Added: , products_subimage1, products_subimage2, products_subimage3, products_subimage4, products_subimage5, products_subimage6 -AND- , '" . tep_db_input($product['products_subimage1']) . "', '" . tep_db_input($product['products_subimage2']) . "', '" . tep_db_input($product['products_subimage3']) . "', '" . tep_db_input($product['products_subimage4']) . "', '" . tep_db_input($product['products_subimage5']) . "', '" . tep_db_input($product['products_subimage6']) . "' tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model,products_image, products_price, products_cost, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_price']) . "', now(), " . (empty($product['products_date_available']) ? "null" : "'" . tep_db_input($product['products_date_available']) . "'") . ", '" . tep_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')"); // EOF: More Pics 6 $dup_products_id = tep_db_insert_id(); $description_query = tep_db_query("select language_id, products_name, products_description, products_url from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$products_id . "'"); while ($description = tep_db_fetch_array($description_query)) { tep_db_query("insert into " . TABLE_PRODUCTS_DESCRIPTION . " (products_id, language_id, products_name, products_description, products_url, products_viewed) values ('" . (int)$dup_products_id . "', '" . (int)$description['language_id'] . "', '" . tep_db_input($description['products_name']) . "', '" . tep_db_input($description['products_description']) . "', '" . tep_db_input($description['products_url']) . "', '0')"); } tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$dup_products_id . "', '" . (int)$categories_id . "')"); $products_id = $dup_products_id; } if (USE_CACHE == 'true') { tep_reset_cache_block('categories'); tep_reset_cache_block('also_purchased'); } } tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $categories_id . '&pID=' . $products_id)); break; case 'new_product_preview': // BOF: More Pics 6 // copy image only if modified /* $products_image = new upload('products_image'); $products_image->set_destination(DIR_FS_CATALOG_IMAGES); if ($products_image->parse() && $products_image->save()) { $products_image_name = $products_image->filename; } else { $products_image_name = (isset($HTTP_POST_VARS['products_previous_image']) ? $HTTP_POST_VARS['products_previous_image'] : ''); } */ // EOF: More Pics 6 // copy image only if modified $products_image = new upload('products_image'); $products_image->set_destination(DIR_FS_CATALOG_IMAGES); if ($products_image->parse() && $products_image->save()) { $products_image_name = $products_image->filename; } else { $products_image_name = (isset($HTTP_POST_VARS['products_previous_image']) ? $HTTP_POST_VARS['products_previous_image'] : ''); } // BOF: More Pics 6 // copy subimage1 only if modified $products_subimage1 = new upload('products_subimage1'); $products_subimage1->set_destination(DIR_FS_CATALOG_IMAGES); if ($products_subimage1->parse() && $products_subimage1->save()) { $products_subimage1_name = $products_subimage1->filename; } else { $products_subimage1_name = (isset($HTTP_POST_VARS['products_previous_subimage1']) ? $HTTP_POST_VARS['products_previous_subimage1'] : ''); } // copy subimage2 only if modified $products_subimage2 = new upload('products_subimage2'); $products_subimage2->set_destination(DIR_FS_CATALOG_IMAGES); if ($products_subimage2->parse() && $products_subimage2->save()) { $products_subimage2_name = $products_subimage2->filename; } else { $products_subimage2_name = (isset($HTTP_POST_VARS['products_previous_subimage2']) ? $HTTP_POST_VARS['products_previous_subimage2'] : ''); } // copy subimage3 only if modified $products_subimage3 = new upload('products_subimage3'); $products_subimage3->set_destination(DIR_FS_CATALOG_IMAGES); if ($products_subimage3->parse() && $products_subimage3->save()) { $products_subimage3_name = $products_subimage3->filename; } else { $products_subimage3_name = (isset($HTTP_POST_VARS['products_previous_subimage3']) ? $HTTP_POST_VARS['products_previous_subimage3'] : ''); } // copy subimage4 only if modified $products_subimage4 = new upload('products_subimage4'); $products_subimage4->set_destination(DIR_FS_CATALOG_IMAGES); if ($products_subimage4->parse() && $products_subimage4->save()) { $products_subimage4_name = $products_subimage4->filename; } else { $products_subimage4_name = (isset($HTTP_POST_VARS['products_previous_subimage4']) ? $HTTP_POST_VARS['products_previous_subimage4'] : ''); } // copy subimage5 only if modified $products_subimage5 = new upload('products_subimage5'); $products_subimage5->set_destination(DIR_FS_CATALOG_IMAGES); if ($products_subimage5->parse() && $products_subimage5->save()) { $products_subimage5_name = $products_subimage5->filename; } else { $products_subimage5_name = (isset($HTTP_POST_VARS['products_previous_subimage5']) ? $HTTP_POST_VARS['products_previous_subimage5'] : ''); } // copy subimage6 only if modified $products_subimage6 = new upload('products_subimage6'); $products_subimage6->set_destination(DIR_FS_CATALOG_IMAGES); if ($products_subimage6->parse() && $products_subimage6->save()) { $products_subimage6_name = $products_subimage6->filename; } else { $products_subimage6_name = (isset($HTTP_POST_VARS['products_previous_subimage6']) ? $HTTP_POST_VARS['products_previous_subimage6'] : ''); } // EOF: More Pics 6 break; } }
Jan Zonjee Posted September 6, 2008 Posted September 6, 2008 I copied from that area down with some of the code: Looks like you missed adding the code for images to the insert query for the copying: // BOF: More Pics 6 Added: , products_subimage1, products_subimage2, products_subimage3, products_subimage4, products_subimage5, products_subimage6 -AND- , '" . tep_db_input($product['products_subimage1']) . "', '" . tep_db_input($product['products_subimage2']) . "', '" . tep_db_input($product['products_subimage3']) . "', '" . tep_db_input($product['products_subimage4']) . "', '" . tep_db_input($product['products_subimage5']) . "', '" . tep_db_input($product['products_subimage6']) . "' tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model, products_image, products_subimage1, products_subimage2, products_subimage3, products_subimage4, products_subimage5, products_subimage6, products_price, products_cost, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_subimage1']) . "', '" . tep_db_input($product['products_subimage2']) . "', '" . tep_db_input($product['products_subimage3']) . "', '" . tep_db_input($product['products_subimage4']) . "', '" . tep_db_input($product['products_subimage5']) . "', '" . tep_db_input($product['products_subimage6']) . "', '" . tep_db_input($product['products_price']) . "', '" . tep_db_input($product['products_cost']) . "', now(), " . (empty($product['products_date_available']) ? "null" : "'" . tep_db_input($product['products_date_available']) . "'") . ", '" . tep_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')"); // EOF: More Pics 6 $dup_products_id = tep_db_insert_id();
Tsuri Japan Posted September 6, 2008 Author Posted September 6, 2008 Ok I want to add this new code but can you tell me what part of the code I forgot or should add.... like after this code ....... add this code. I'm good good at editing text usually but I guess I good somewhere. UPDATE.... Ok I figured out how to add that code of the xtra images and thanks for that. Now it'll copy all the images when I go to make a copy. That was something I had to deal with for 2 years and now it'll be nice when I go to make a copy it'll copy all the images. But the error still lives.... Maybe I'll go to the contrib and start a thread in there....
Jan Zonjee Posted September 6, 2008 Posted September 6, 2008 But the error still lives.... It would help if you post the error code here instead of going somewhere else again for starting this whole thread again. I couldn't find an error in the new insert query but I might be wrong.
Tsuri Japan Posted September 6, 2008 Author Posted September 6, 2008 I thought I posted the error code on the top of my message...sorry I'm not too sure what you meant by error code? Where do I find the error code? Nigel
Jan Zonjee Posted September 6, 2008 Posted September 6, 2008 I thought I posted the error code on the top of my message... If it is still exactly this error: 1136 - Column count doesn't match value count at row 1 insert into products (products_quantity, products_model, products_image, products_price, products_cost, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('0', 'SL17-GLD', 'daiwaSL-17-A2.jpg', '2400.0000', now(), null, '50', '0', '0', '12') ... then you didn't change the insert query. Simple as that. If you did change it, it would be different.
Tsuri Japan Posted September 12, 2008 Author Posted September 12, 2008 I dunno I'm still looking into this error, does this code seem ok? } elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') { // BOF: More Pics 6 Added: , products_subimage1, products_subimage2, products_subimage3, products_subimage4, products_subimage5, products_subimage6 $product_query = tep_db_query("select products_quantity, products_model, products_image, products_subimage1, products_subimage2, products_subimage3, products_subimage4, products_subimage5, products_subimage6, products_price, products_cost, products_date_available, products_weight, products_tax_class_id, manufacturers_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); // EOF: More Pics 6 $product = tep_db_fetch_array($product_query); I think it's when I added the contrib called margin report and I may of did something wrong when I added the new code.
Tsuri Japan Posted September 16, 2008 Author Posted September 16, 2008 I think the problem is in the SQL tables... I've read some other things and most people say it's something to do with it not writing enough tables. Any ideas? This sucks because I can't duplicate a product now and it takes way more time now if to duplicate an item. Thanks, Nigel
Jan Zonjee Posted September 16, 2008 Posted September 16, 2008 I think the problem is in the SQL tables... I've read some other things and most people say it's something to do with it not writing enough tables. Any ideas? See post 10.
Tsuri Japan Posted September 17, 2008 Author Posted September 17, 2008 See post 10. Sorry I don't quite get what you mean... ... then you didn't change the insert query. Simple as that. If you did change it, it would be different. Do you mean if I do a different product and do I get the same error? What ever products I decide to duplicate I get that error. I can move products ok and copy one from the other but just can DUPLICATE a product.
Jan Zonjee Posted September 17, 2008 Posted September 17, 2008 Sorry I don't quite get what you mean... Look at the error message you posted earlier: 1136 - Column count doesn't match value count at row 1 insert into products (products_quantity, products_model, products_image, products_price, products_cost, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('0', 'SL17-GLD', 'daiwaSL-17-A2.jpg', '2400.0000', now(), null, '50', '0', '0', '12') The number of columns between the first parentheses: products_quantity, products_model, products_image, products_price, products_cost, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id should match the number of values between the second pair of parentheses: '0', 'SL17-GLD', 'daiwaSL-17-A2.jpg', '2400.0000', now(), null, '50', '0', '0', '12' As you can clearly see the number of columns is 11 but the number of values is 10, so there is a value missing. If you post the error you get now we might be able to see what is wrong but if you only want to theorize on what might be wrong than that is fine with me too. I don't have the problem :)
Tsuri Japan Posted September 18, 2008 Author Posted September 18, 2008 wow ok nice that was very well put and I see where the error is now... It's definately in the second parentheses and it's the product cost. Do you know where the code is for this section is? Then I can inspect and see where I messed up.
Tsuri Japan Posted September 18, 2008 Author Posted September 18, 2008 Does this code look correct? I think this might be the problem.... } elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') { // BOF: More Pics 6 Added: , products_subimage1, products_subimage2, products_subimage3, products_subimage4, products_subimage5, products_subimage6 $product_query = tep_db_query("select products_quantity, products_model, products_image, products_subimage1, products_subimage2, products_subimage3, products_subimage4, products_subimage5, products_subimage6, products_price, products_cost, products_date_available, products_weight, products_tax_class_id, manufacturers_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); // EOF: More Pics 6 $product = tep_db_fetch_array($product_query); I found one problem with the code in my admin/catergories but I still get this updated TEP STOP problem: 1136 - Column count doesn't match value count at row 1 insert into products (products_quantity, products_model,products_image, products_price, products_cost, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('1', 'EZ42M-BL', 'EZ42MBlue1.jpg', 'EZ42MBlue2.jpg', 'EZ42Mgroupshot.jpg', 'EZ42Maction.jpg', 'EZ42MFISH.jpg', '', '', '3400.0000', '2400.0000', now(), '', '250', '0', '0', '16') [TEP STOP]
Jan Zonjee Posted September 18, 2008 Posted September 18, 2008 Does this code look correct? I think this might be the problem.... } elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') { // BOF: More Pics 6 Added: , products_subimage1, products_subimage2, products_subimage3, products_subimage4, products_subimage5, products_subimage6 $product_query = tep_db_query("select products_quantity, products_model, products_image, products_subimage1, products_subimage2, products_subimage3, products_subimage4, products_subimage5, products_subimage6, products_price, products_cost, products_date_available, products_weight, products_tax_class_id, manufacturers_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); // EOF: More Pics 6 $product = tep_db_fetch_array($product_query); I found one problem with the code in my admin/catergories but I still get this updated TEP STOP problem: In the insert query right after this piece of code you forgot to add products_subimage1, products_subimage2, products_subimage3, products_subimage4, products_subimage5, products_subimage6, So now you have: tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model,products_image, products_price, products_cost, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values etcetera, etcetera .... but it should be: tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model, products_image, products_subimage1, products_subimage2, products_subimage3, products_subimage4, products_subimage5, products_subimage6, products_price, products_cost, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values etcetera, etcetera .....
Tsuri Japan Posted September 19, 2008 Author Posted September 19, 2008 Ok so you have solved my problem!!! :lol: :lol: I owe you a big and thank you for putting up with me and my long thread about this nagging problem. I actually added that code of xtra images like 2 1/2 years ago so I guess it was a ticking time bomb ready to go off one day... Again thanks for your patience in this matter, OS Commerce rocks! Nigel
Recommended Posts
Archived
This topic is now archived and is closed to further replies.