TCOB1 Posted January 8, 2010 Posted January 8, 2010 I am getting this error when using the copy feature - duplicate product. This was working before. The only change I have made was install the Canada Post shipping module. I'm guessing there needs to a change made to the database but to which section. 1136 - Column count doesn't match value count at row 1 insert into products (products_quantity, products_model, products_image, products_price, products_date_added, products_date_available, products_weight, products_dim_type, products_weight_type, products_length, products_width, products_height, products_ready_to_ship, products_status, products_tax_class_id, manufacturers_id) values ('0', '', 'cutaway.png', '28.2900', now(), '', '50.00', '35.00', '10.00', '10.00', '', '0', '1', '0') [TEP STOP]
♥mdtaylorlrim Posted January 8, 2010 Posted January 8, 2010 I am getting this error when using the copy feature - duplicate product. This was working before. The only change I have made was install the Canada Post shipping module. I'm guessing there needs to a change made to the database but to which section. 1136 - Column count doesn't match value count at row 1 insert into products (products_quantity, products_model, products_image, products_price, products_date_added, products_date_available, products_weight, products_dim_type, products_weight_type, products_length, products_width, products_height, products_ready_to_ship, products_status, products_tax_class_id, manufacturers_id) values ('0', '', 'cutaway.png', '28.2900', now(), '', '50.00', '35.00', '10.00', '10.00', '', '0', '1', '0') [TEP STOP] Well, this means that the sql statement is saying, "Hey, I got 16 columns here that need new information and I got 14 values to put in them" so it is saying back to you "What do you want me to put in the two extra columns?" You're gonna have to find that statement and go up a couple of lines to where it populates that statement and find out why you have two extra columns or 2 few values. Probably in your /admin/categories.php around line 330 give or take add-ons. Community Bootstrap Edition, Edge Avoid the most asked question. See How to Secure My Site and How do I...?
TCOB1 Posted January 9, 2010 Author Posted January 9, 2010 Well, this means that the sql statement is saying, "Hey, I got 16 columns here that need new information and I got 14 values to put in them" so it is saying back to you "What do you want me to put in the two extra columns?" You're gonna have to find that statement and go up a couple of lines to where it populates that statement and find out why you have two extra columns or 2 few values. Probably in your /admin/categories.php around line 330 give or take add-ons. Thanks mdtaylorlrim for the quick reply. I checked the file and your line number was very close (300). If I'm reading this correct there are 4 addional values in the 'TABLE_PRODUCTS' from the 'DUPLICATE' list of values. Since the 4 values are in the database, can I just add them to the 'duplicate' list? } elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') { $product_query = tep_db_query("select products_quantity, products_model, products_image, products_price, products_date_available, products_weight, products_length, products_width, products_height, products_ready_to_ship, products_tax_class_id, manufacturers_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); $product = tep_db_fetch_array($product_query); tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model, products_image, products_price, products_date_added, products_date_available, products_weight, products_dim_type, products_weight_type, products_length, products_width, products_height, products_ready_to_ship, 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(), '" . tep_db_input($product['products_date_available']) . "', '" . tep_db_input($product['products_weight']) . "', '" . tep_db_input($product['products_length']) . "', '" . tep_db_input($product['products_width']) . "', '" . tep_db_input($product['products_height']) . "', '" . tep_db_input($product['products_ready_to_ship']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')"); Glen
♥mdtaylorlrim Posted January 9, 2010 Posted January 9, 2010 Thanks mdtaylorlrim for the quick reply. I checked the file and your line number was very close (300). If I'm reading this correct there are 4 addional values in the 'TABLE_PRODUCTS' from the 'DUPLICATE' list of values. Since the 4 values are in the database, can I just add them to the 'duplicate' list? You could do that, although I believe those four values might all have default values in the database. For example, the data added should default to todays date when adding a new product. I really do not know what the author intended when copying an item. And as the shop owner you have to decide if you want those four values copied from the original item and placed in the new item, or if the default values should be inserted. If it were me I'd probably do just what you suggest and test it for results, knowing that some of those are not editable from the scripts and that any desired change would have to be done with a tool like phpMyAdmin. Also, there are two fields that are not part of the stock osc so you will need to identify what effect it will have to copy those fields from one to the other. Perhaps an add on did not change this line like it should have, or you did not completely reverse an add on that you removed... Make sure those fields are actually in the db. Community Bootstrap Edition, Edge Avoid the most asked question. See How to Secure My Site and How do I...?
TCOB1 Posted January 9, 2010 Author Posted January 9, 2010 You could do that, although I believe those four values might all have default values in the database. For example, the data added should default to todays date when adding a new product. I really do not know what the author intended when copying an item. And as the shop owner you have to decide if you want those four values copied from the original item and placed in the new item, or if the default values should be inserted. If it were me I'd probably do just what you suggest and test it for results, knowing that some of those are not editable from the scripts and that any desired change would have to be done with a tool like phpMyAdmin. Also, there are two fields that are not part of the stock osc so you will need to identify what effect it will have to copy those fields from one to the other. Perhaps an add on did not change this line like it should have, or you did not completely reverse an add on that you removed... Make sure those fields are actually in the db. I did take a look at the database and noticed "products_dim_type" and "products_weight_type" are not there. I recalled a post about an install error for the module regarding "products_dim_type" should have read products_weight. As product_weight was already in the list, I deleted "products_dim_type" and "products_weight_type" from the table_product list, uploaded the correction and all works fine now. Thanks for pointing my in the right direction.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.