Show Out Of Stock If Back In Stock Is Enabled

Hi,

We want to disable 'Show out of stock products' in general settings to automatically hide products that have zero qty. However, we'd like those products with 'Sign up for notification' enabled for 'Out of stock actions' to still be visible in the storefront. I know this will require some coding but I'm guessing it should be just a few lines probably.

Can anyone help with this? I'm using Multivendor 4.3.2

Thanks

try the following:

- open the app/functions/fn.catalog.php file

- replace

$condition .= db_quote(
            ' AND (CASE products.tracking' .
            '   WHEN ?s THEN inventory.amount > 0' .
            '   WHEN ?s THEN products.amount > 0' .
            '   ELSE 1' .
            ' END)',
            ProductTracking::TRACK_WITH_OPTIONS,
            ProductTracking::TRACK_WITHOUT_OPTIONS
        );

with

$condition .= db_quote(
            ' AND (CASE products.tracking' .
            '   WHEN ?s THEN ((inventory.amount > 0 AND products.out_of_stock_actions != "S") OR products.out_of_stock_actions = "S")' .
            '   WHEN ?s THEN ((products.amount > 0 AND products.out_of_stock_actions != "S") OR products.out_of_stock_actions = "S")' .
            '   ELSE 1' .
            ' END)',
            ProductTracking::TRACK_WITH_OPTIONS,
            ProductTracking::TRACK_WITHOUT_OPTIONS
        );

- clear cache (&cc&ctpl)

- check the result

try the following:

- open the app/functions/fn.catalog.php file

- replace

$condition .= db_quote(
            ' AND (CASE products.tracking' .
            '   WHEN ?s THEN inventory.amount > 0' .
            '   WHEN ?s THEN products.amount > 0' .
            '   ELSE 1' .
            ' END)',
            ProductTracking::TRACK_WITH_OPTIONS,
            ProductTracking::TRACK_WITHOUT_OPTIONS
        );

with

$condition .= db_quote(
            ' AND (CASE products.tracking' .
            '   WHEN ?s THEN ((inventory.amount > 0 AND products.out_of_stock_actions != "S") OR products.out_of_stock_actions = "S")' .
            '   WHEN ?s THEN ((products.amount > 0 AND products.out_of_stock_actions != "S") OR products.out_of_stock_actions = "S")' .
            '   ELSE 1' .
            ' END)',
            ProductTracking::TRACK_WITH_OPTIONS,
            ProductTracking::TRACK_WITHOUT_OPTIONS
        );

- clear cache (&cc&ctpl)

- check the result

This worked! thanks eComlabs!

You are welcome!

Hello ecomlabs,
Can work also for Cs-cart 4.15.x ?

thanks

Unfortunately, no. The inventory alias is not used anymore