Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Add a new product?


hazamonzo

Recommended Posts

Posted

So our OSC site has been up and running (not live) to allow us to add products to our database. Then out of the blue while a friend of mone was adding products to the database we came up against a problem =(

 

He had added 5/6 products successfully when all of a sudden he goes to add the 7th product (I doubt the number of products he added before has anything to do with it btw) when all of a sudden he is looking at the "Add Product" page (so far so good) but instead of being presented with a BLANK form in which to fill in he is looking at the "Add Product" page with a semi filled in form. The data already inpuuted into this form is also quite interesting as it came from the last product he added (6th product). We Decided that considering we are faced with a semi filled in form to remove what data had been placed into the input fields/textareas and type in the information for the 7th product. We click PREVIEW and then INSERT but instead of of adding the 7th product we get this funky MySQL error:

 

(The interesting part of the error below)

 

1062 - Duplicate entry '0' for key 1

 

(the not so interesting part as its just the insert query for the new product)

 

insert into products (products_quantity, products_model, products_price, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id, products_date_added) values ('', '', '', null, '', '1', '0', '', now())

 

Soooo, calling all MySQL/PHP/OSC Peepz!!! i need your help =)

 

Just so you know aswell, i have not changed a think with my version of OSC it is running straight out of the box and i did not edit any code before this happened =)

 

I am a PHP?MySQL developer but this atm has stumped me. The only really interesting reference i found was here at MySQL at the bottom of the page some says this....

 

"....The duplication of the key has been occurring because the DATA HAS BEEN

CORRUPTED!!!......."

 

Anyway, hope thats enough information. I am not that stupid so please dont be affraid to ask questions as i will do my best to answer them!! =)

 

Kind Regards

 

Harris

Posted

Still no luck with this =(

 

I cant see whats wrong. I really think it has to be the data but what doesnt make sense is that i am adding a new product so how can the categories.php script fill these fields in??! It really makes no sense.

 

This is the URL when i need to add a new product:

 

http://www.mydomain.com/testshop/admin/categories.php?cPath=27_86&action=new_product

 

This is the URL when i try to edit an existing product:

 

http://www.mydomain.com/testshop/admin/categories.php?cPath=27_86&pID=0&action=new_product

 

Notice that when i ADD a new product there is NO pID (product ID) in the url thus the categories.php script should NOT retrive any data from the database.

 

Im really in a fix atm so any help would REALLY be apprecitaed! =)

 

Kind Regards

 

Harris

Archived

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

×
×
  • Create New...