Disable Out Of Stock Products After 24Hrs Not Hide But Actually Disabling It

how to disable out of stock products after 24hrs not hide but actually Disabling it

CS-Cart does not store timestamp of the moment when the product was sold out. So additional development work is required to do it.

How can i disabled out of stock products from php?

For example,

db_query("UPDATE ?:products SET status = ?s WHERE amount <= ?i", 'D', 0);

Thanks, so no easy way to set a time stamp when product go out of stock?

Status of a product (active, hidden, disabled) is not changed for out of stock items. The settings control what's to happen for out of stock items defined as quantity (amount) <= 0. I.e. whether to be displayed or not, whether they can be added to the cart, etc. Not sure what the 'timestamp' has to do with whether a product is is-stock or not.

I want to change status of products to hidden after it's out of stock, but i want this to happen after 24hrs

Would require an addon or modification to do so. Researching the best way to do this is most of the work.

Thanks, so no easy way to set a time stamp when product go out of stock?

There is no easy way. You should use hooks in the fn_update_product_amount function (app/functions/fn.cart.php)

There is no easy way. You should use hooks in the fn_update_product_amount function (app/functions/fn.cart.php)

Can i clone this {"SELECT viewed FROM ?:product_popularity WHERE product_id = ?i"|db_get_field:$product.product_id} the aim is clear the cloned product views and leave actual product views one

i tried changing viewed to prd_viewed but it didn't work;

{"SELECT viewed FROM ?:product_popularity WHERE product_id = ?i"|db_get_field:$product.product_id}

Can i clone this {"SELECT viewed FROM ?:product_popularity WHERE product_id = ?i"|db_get_field:$product.product_id} the aim is clear the cloned product views and leave actual product views one

i tried changing viewed to prd_viewed but it didn't work;

{"SELECT viewed FROM ?:product_popularity WHERE product_id = ?i"|db_get_field:$product.product_id}

Your message is not quite clear. Please clarify

I want to create a duplicate column for product count as prd_views

then be able to update it to zero without wiping the actual product views stored on the column viewed

This will show the product views

{"SELECT viewed FROM ?:product_popularity WHERE product_id = ?i"|db_get_field:$product.product_id}

I want to have a clone of the above that gets from column prd_viewed in stead of viewed

{"SELECT prd_viewed FROM ?:product_popularity WHERE product_id = ?i"|db_get_field:$product.product_id}

Then be able to update prd_viewed count using php

{"UPDATE prd_viewed FROM ?:product_popularity WHERE product_id = ?i"|db_get_field:$product.product_id} set the count to zero