Jump to content

[version: 1.6.1.11] Error: Duplicate entry INSERT INTO `ps16_specific_price`


catzarov

Recommended Posts

Hello Comrades,

Last week I did an upgrade from 1.6.1.10 to last version: 1.6.1.11

The upgrade went without problems. Everything was fine.

 

Now I have the following problem.
Some products I can not edit them :( because there are duplicate something and I don't know what?
 
Example Screen:
post-856643-0-55498700-1486567742_thumb.png
 
Messages is:
INSERT INTO `ps16_specific_price` (`id_shop_group`, `id_shop`, `id_cart`, `id_product`, `id_product_attribute`, `id_currency`, `id_specific_price_rule`, `id_country`, `id_group`, `id_customer`, `price`, `from_quantity`, `reduction`, `reduction_tax`, `reduction_type`, `from`, `to`) VALUES ('0', '1', '0', '2424', '0', '0', '5', '0', '7', '0', '-1', '1', '0.1', '1', 'percentage', '2017-01-01 00:00:00', '2020-02-20 22:22:22')

I can't understand what the problem is!!!

 
I have several promotions with the same dates, whether it is because of this?
post-856643-0-02135200-1486568122_thumb.png
 
Please help how to fix this problem?
Link to comment
Share on other sites

As far as I can understand (the error description is partially missing) the error message says that in the database table there is already a product with the ID 2424, therefore the insert query fails.

What I cannot understand is why the tentative to edit a product generates an insert query instead of an update query...

 

Assuming the only database table affected by the edit is the one giving the error, you should be able to work-around the issue by working directly on the database.

First fetch the current values and write them down somewhere (in this way you will be able to change them back in case of errors):

SELECT id_shop_group`, `id_shop`, `id_cart`, `id_product`, `id_product_attribute`, `id_currency`, `id_specific_price_rule`, `id_country`, `id_group`, `id_customer`, `price`, `from_quantity`, `reduction`, `reduction_tax`, `reduction_type`, `from`, `to`
FROM `ps16_specific_price`
WHERE `id_product` = '2424';

Then update the values:

UPDATE `ps16_specific_price`
SET `id_shop_group` = '0', `id_shop` = '1', `id_cart` = '0', `id_product_attribute` = '0', `id_currency` = '0', `id_specific_price_rule` = '5', `id_country` = '0', `id_group` = '7', `id_customer` = '0', `price` = '-1', `from_quantity` = '1', `reduction` = '0.1', `reduction_tax` = '1', `reduction_type` = 'percentage', `from` = '2017-01-01 00:00:00', `to` = '2020-02-20 22:22:22'
WHERE `id_product` = '2424'; 

Anyway, before running the query:

  1. double-check the product ID is unique
  2. double-check the product ID refers to the product you want to update
  3. write down the old values
  • Like 1
Link to comment
Share on other sites

Hello Mr. Cannilla Saverio,

 

Thank you for your extremely comprehensive answer.

I do not dare to make the proposed changes in my SQL.

The easiest thing I did is to delete a Catalog Price Rules :(

I don't have a "corporate" reductions for my big customers, but eshop now functioning properly and I can edit the products.

 

I'm sure the problem which I had from the first post in consequence of the last update, because my promotions (who i deleted) were made 2-3 months ago.

 

I hope this problem is just in my eshop.

 

Best Regards

  • Like 1
Link to comment
Share on other sites

That is the "famous" index restriction (unique key) of the discounts that makes sure that you don't make two discounts for exactly the same group/time.

 

Catalogue rules are translated by the software in specific prices for each affected product too so they count too. 

 

As with different versions of Prestashop this key has been changed it may be that you noticed that.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...