Jump to content

Set visibility to none for products with quantity=0 and set visibility to both for products in stock


Recommended Posts

I am trying to achieve visibility set to none for all products out of stock (with quantity=0) and visibility set to both for products in stock (quantity>0)

with code below. Unfortunately it does not work.

 

Could anyone help me out solving this?

<?php
$link = mysql_connect('localhost', 'user', 'password');
if (!$link) {
    die('No connection possible: ' . mysql_error());
}
mysql_select_db('prestashop');

mysql_query('UPDATE ps_product_shop SET visibility=none WHERE id_product IN (SELECT id_product FROM ps_stock_available WHERE quantity=0)');

mysql_query('UPDATE ps_product_shop SET visibility=both WHERE id_product IN (SELECT id_product FROM ps_stock_available WHERE quantity>0)');

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