Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Database duplicating entries - how to fix?


boidski

Recommended Posts

Hi guys,

I have implemented an Index mod, to reindex my store. I followed instructions, and I thought all was good. Now, whenever I enter a NEW product into the catalog, I get a tep_stop error.

 

<code>

 

1062 - Duplicate entry '82' for key 1

 

insert into products_description (products_name, products_description, products_url, products_id, language_id) values ('', '', '', '82', '2')

 

[TEP STOP]

 

</code>

 

It also appears that the entries are duplicating, or triplicating in the database...I have entries such as these:

 

<code>

 

insert into categories_description (categories_id, language_id, categories_name) values ('38', '1', 'SOCKET 478');

insert into categories_description (categories_id, language_id, categories_name) values ('38', '2', '');

insert into categories_description (categories_id, language_id, categories_name) values ('38', '3', '');

 

</code>

Why does it appear 3 times?

 

If anyone could give me a pointer in the right direction, I would be very gratefull.

 

Thank you.

 

Brian

Link to comment
Share on other sites

One for each language. You should build your categories_description index using both products_id and language_id rather than just products_id. Otherwise, it won't be unique.

 

Hth,

Matt

Link to comment
Share on other sites

You should build your categories_description index using both products_id and language_id rather than just products_id

 

How do I do that? I currently have:

 

categories_description  (categories_id, language_id, categories_name);

 

should I change it to:

categories_description  (product_id, language_id, categories_id, language_id, categories_name);

 

I am very new to this, sorry if I don't understand proper coding techniques.

Link to comment
Share on other sites

Sorry, I'm mixing your two examples. The database structure is fine. However, when you created the database, it looks like you set the products_id field as a unique index for products_description. Unfortunately, it's not, as it will be repeated for each language that is installed.

 

The SQL would look like:

CREATE INDEX (products_id, language_id) ON products_description;
CREATE INDEX (categories_id, language_id) on categories_description;

Hth,

Matt

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...