1

Last week I asked a question about swapping the two. I was given a solution ( Is there a way to swap cross-sells and up-sells easily? ).
Today my guy tried to implement it and got this error: Error Code: 1062. Duplicate entry '5-6194-9438' for key 'UNQ_mg_CAT_PRD_LNK_LNK_TYPE_ID_PRD_ID_LNKED_PRD_ID'

Is there something we're missing?

1

Barry,remove foreign key from table using SET foreign_key_checks = 0;then run marius update query. after that enable foreign key of table SET foreign_key_checks = 1;

Make a clone of table catalog_product_link.I guess table is close table name is catalog_product_link_cp

Query 1:

UPDATE catalog_product_link  
SET catalog_product_link.link_type_id = 4 where  catalog_product_link.link_id in (select catalog_product_link_cp.link_id from catalog_product_link_cp where catalog_product_link_cp.link_type_id = 5  )

Query 2:

UPDATE catalog_product_link  
SET catalog_product_link.link_type_id = 5 where  catalog_product_link.link_id in (select catalog_product_link_cp.link_id from catalog_product_link_cp where catalog_product_link_cp.link_type_id = 4  )
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.