Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Set Product Status per Specials Status


Guest

Recommended Posts

I would like to make it so that a product's status is dependent on their specials status. I made the following function, but nothing seems to be happening: (using osc 2.3.1)

If the product is not in the specials (id or status = null), or specials status = 0, set products_status = 0.

if the product is in the specials and specials status = 1, set products_status = 1.

I put this function set into includes/functions/specials.php and admin/includes/functions/general.php.

 

Can anyone offer some help on this subject? Or is there another angle I should look at, such as changing the specials files from a 'specials' products_status to a 'products' products_status?

++++++++++++++++

 

$prodspec_query = tep_db_query("select p.products_id, p.products_status, sp.products_id, sp.status from " . TABLE_PRODUCTS . " p, " . TABLE_SPECIALS . " sp where p.products_id = sp.products_id");

$prodspec = tep_db_fetch_array($prodspec_query);

$sp_status = $prodspec['sp.status'];

$product_id = $prodspec['sp.products_id'];

 

function tep_set_product_to_sale_status($product_id, $sp_status){

if($status == '0' || $status == NULL || $product_id == NULL){

return tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . $product_id . "'");

}elseif($status == '1'){

return tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '1' where products_id = '" . $product_id . "'");

}

}

Link to comment
Share on other sites

A product should not display unless it has an active special sale price. If the special's status is active, then activate the product. If the special's status is either inactive or does not exist (product does not have a special price), then set the product's status to inactive.

Link to comment
Share on other sites

Why bother with specials at all? Just ignore the specials section and set your products to active/inactive as required.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

I would love to, but unfortunately I'm tied into it. I don't actually use the specials.php page. I'm using Multiple Sales Per Product, which sets up sales at specific dates and times. According to those times, when the specials become active or inactive or deleted from specials, I need the products themselves to become active and inactive.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...