Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

I have two problems


scooterfactory

Recommended Posts

I have 2 problems I need fixed.....

 

Problem #1. Product Attributes.

 

1062 - Duplicate entry '0-1' for key 1

 

insert into products_options (products_options_id, products_options_name, language_id, products_options_type, products_options_length, products_options_comment) values ('0', '', '1', '', '', '')

 

[TEP STOP]

 

Upon entering information in the product values field I get this error. Now what I see happening is that it enters a value in product options but with an ID of 0, even though there are already 36 IDs in the db. If I try to enter any more items in the product values field I get this error. If I delete it from the db the prob goes away until I try to input more items into the OSC admin.

 

Problem #2. Categories/Products.

 

For some odd reason whenever I try to add an image as the MAIN IMAGE, the preview button gets stuck. I see in the IE that "done with errors on page" thing in the bottom. When I click the preview button without any text input'ed in the box it processes the page and goes onto the next page even though nothing was uploaded or processed. This prob just started about a week ago and I really need it up and running to add more items to the site.

Link to comment
Share on other sites

Problem #1. Product Attributes.

 

1062 - Duplicate entry '0-1' for key 1

 

insert into products_options (products_options_id, products_options_name, language_id, products_options_type, products_options_length, products_options_comment) values ('0', '', '1', '', '', '')

 

[TEP STOP]

 

Upon entering information in the product values field I get this error. Now what I see happening is that it enters a value in product options but with an ID of 0, even though there are already 36 IDs in the db. If I try to enter any more items in the product values field I get this error. If I delete it from the db the prob goes away until I try to input more items into the OSC admin.

I think you can fix that by changing something in admin/product_attributes.php around line 61:

	  case 'add_product_attributes':
	$products_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);
	$options_id = tep_db_prepare_input($HTTP_POST_VARS['options_id']);
	$values_id = tep_db_prepare_input($HTTP_POST_VARS['values_id']);
	$value_price = tep_db_prepare_input($HTTP_POST_VARS['value_price']);
	$price_prefix = tep_db_prepare_input($HTTP_POST_VARS['price_prefix']);

	tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES . " values ('', '" . (int)$products_id . "', '" . (int)$options_id . "', '" . (int)$values_id . "', '" . tep_db_input($value_price) . "', '" . tep_db_input($price_prefix) . "')");

The last line should be changed (IMHO) to:

		tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES . " values (NULL, '" . (int)$products_id . "', '" . (int)$options_id . "', '" . (int)$values_id . "', '" . tep_db_input($value_price) . "', '" . tep_db_input($price_prefix) . "')");

So two single quotes are replaced by NULL as the first value. It is a MySQL5 thing.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...