Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Problem after duplicate 'special' added


dcmo

Recommended Posts

I've just been adding lots of products to the special offers section. The Specials section looked fine, but when I moved to one of the ordinary categories I got this:

 

1062 - Duplicate entry '964' for key 1

 

insert into specials_retail_prices select s.products_id, s.specials_new_products_price, s.status, s.customers_group_id from specials s where s.customers_group_id = '0'

 

[TEP STOP]

 

I did have a slight worry I'd entered one item twice from the broken category, so I went in and removed it from the specials and hurray, all is now repaired and the category pages are working fine.

 

BUT, if I try to add the product into the specials again, it breaks it :'(

 

Not an urgent problem as the shop is working so long as I don't put that item in as a special offer .... but anyone any idea what's gone wrong?

 

:thumbsup: dcmo

 

 

edit: oops, this probably shouldn't be in contributions support.

Edited by dcmo
Link to comment
Share on other sites

I did have a slight worry I'd entered one item twice from the broken category, so I went in and removed it from the specials and hurray, all is now repaired and the category pages are working fine.

 

BUT, if I try to add the product into the specials again, it breaks it

Looks like that product with a specials price for retail is already in the specials table. What does phpMyAdmin return when you execute the sql command:

select customers_group_id, specials_new_products_price, products_id from specials where products_id = '964' and customers_group_id = '0';

The error comes from the rebuilding of the specials_retail_prices table (for the SPPC contribution) when you hit the categories and need a sort by price.

Link to comment
Share on other sites

.. err... can I just delete one of them?
Well, since you don't know the status and end date you might as well delete them both and add the special again from the osC admin section.

 

Interesting that you can have two with the same customer_group_id (obviously you shouldn't). I should take a look at that, see if that can be prevented.

Link to comment
Share on other sites

Thanks JanZ, that worked a treat. Well, in fact it worked for that item but then I immediately got the same error with a different product_id :-" so I went in and repeated your query with the new number and deleted that one too and THEN all was well B)

 

Obviously it was a mistake adding the same product twice, but easily done :blush: . Did this error only occur because of SPPC ? What happens if you add something twice without SPPC installed?

 

What would really help is if the drop down list (on the specials page of admin) only listed items not already on offer, but that mod is beyond my skills :o (at the moment anyway!).

Link to comment
Share on other sites

Thanks JanZ, that worked a treat. Well, in fact it worked for that item but then I immediately got the same error with a different product_id :-" so I went in and repeated your query with the new number and deleted that one too and THEN all was well B)

 

Obviously it was a mistake adding the same product twice, but easily done :blush: . Did this error only occur because of SPPC ? What happens if you add something twice without SPPC installed?

Never tried that I think. I know MySQL wouldn't be bothered with it, because the index of the table is an autoincrement field with specials_id. In the table products_groups it can't happen because the primary index is made up of products_id and customers_group_id.

 

What would really help is if the drop down list (on the specials page of admin) only listed items not already on offer, but that mod is beyond my skills :o (at the moment anyway!).
Yeah, well being able to deal with all the group prices in one go when you add a special wouldn't be bad either.

 

You are aware of the Admin Specials by Categories for SPPC contribution (original by Carine Bruyndoncx)? Might be useful when you have lots of specials.

Link to comment
Share on other sites

Yeah, well being able to deal with all the group prices in one go when you add a special wouldn't be bad either.

 

You are aware of the Admin Specials by Categories for SPPC contribution (original by Carine Bruyndoncx)? Might be useful when you have lots of specials.

Yes, you're right, the standard procedure for adding Specials isn't very friendly when you have 2000+ products :rolleyes: . No, I hadn't come across that contribution - I've just had a quick look and it does look useful. I'm off to have a closer look :thumbsup:

 

thanks for the help :D

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...