2

I'm the guy that does the data entry for our cross-sells and up-sells on our store page. Unfortunately, the marketing person would like all cross-sells and up-sells to be swapped. Is this possible? Failing that, is there a better way to gather product ID's for copy and paste purposes?

5

Up-sells and cross-sells relations are both kept in the same table: catalog_product_link.
the only difference between the 2 relations it the link_type_id column.
For up-sells the value is 4 and for cross-sells it is 5.

so you can swap them through a single query:

UPDATE 
    `catalog_product_link` 
SET 
    `link_type_id` = 9 - `link_type_id` 
WHERE 
    `link_type_id` IN (4,5)

But back up the table first.

| improve this answer | |
  • That's a very clever 'hack' using 9 - x to switch the numbers. – Peter O'Callaghan Feb 23 '15 at 21:27
  • @Cags. I was good at math and "twisted" problems when I was young. I still remember some tricks :) – Marius Feb 23 '15 at 21:33
  • 1
    Hopefully you never forget you did the twist ... – roman204 Feb 24 '15 at 5:18
  • You're a saint! – Barry Feb 24 '15 at 14:28

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.