Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

xsell from file automation - mysql question


Recommended Posts

I am working on a feature to automate the xsell process through a txt file.


But I have troubles with the SQL statement where I need to only insert those article numbers, which are already integrated in the shop. I even dont know if the EXISTS can be put there or if it should be done another way.


'INSERT INTO ' . TABLE_PRODUCTS_XSELL . ' (products_id,xsell_id) values (

(SELECT `products_id` FROM ' . TABLE_PRODUCTS . ' WHERE `products_model` LIKE ' . $data[0]. ' AND `products_status` =1 and exists `products_id` not null),

(SELECT `products_id` FROM ' . TABLE_PRODUCTS . ' WHERE `products_model` LIKE ' . $data[1] . ' AND `products_status` =1 and exists `products_id` not null)

) '


Without the EXISTS syntax it is working along the file until the 1st non existing article in the shop appears.


thx for your input.

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.

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...