Default status when adding a product

Anyone know where I can change the default status when adding a product in the admin to Disabled instead of Active? Thanks

directly in the database… Change the default value for 'status' from 'A' to 'D' (or 'H') in the cscart_products table.

[quote name='tbirnseth' timestamp='1321320471' post='125983']

directly in the database… Change the default value for 'status' from 'A' to 'D' (or 'H') in the cscart_products table.

[/quote]



I did that but when clicking Add Product, Active was still the default (I have two people adding products and only complete products should be Active – sometimes they forget to click Disabled). I found the tpl file that controls this (common_templates/select_status.tpl) but I can't figure out how to get the whole thing to work so that only when adding products is it defaulted to Disabled.



Here's the code:


```php



{$lang.status}:



{if $items_status}

{if !$items_status|is_array}

{assign var=“items_status” value=$items_status|yaml_unserialize}

{/if}

{foreach from=$items_status item=“val” key=“st” name=“status_cycle”}

{$obj_id|default:0}{$st|lower}” {if $obj.status == $st || (!$obj.status && $smarty.foreach.status_cycle.first)}checked=“checked”{/if} value=“{$st}” class=“radio” />{$val}

{/foreach}

{else}

a" {if $obj.status == “A” || !$obj.status}checked=“checked”{/if} value=“A” class=“radio” />{$lang.active}



{if $hidden}

{$lang.hidden}

{/if}



I interpreted your question differently, sorry if my assumption is incorrect.



Do you mean when you add a product, the 'Status' option (Active, Hidden or Disabled) will automatically be set to Hidden or Disabled, as default, the cart sets it to Active, without you having to change this option to get to the desired status?



If so, this can be changed by moving the 'checked' tag and if statement to the appropriate status you want set as default, to achieve this, take a look in:



/skins/yourtheme/admin/common_templates/select_status.tpl



Replace:




{if $hidden}

{/if}




With:




{if $hidden}

{/if}




When adding a new product, this will set the radio box for Status to 'Disabled' instead of the default 'Active'. Once you select another option and save, your new chosen status will take effect from the product being disabled.

Thanks! That is exactly what I needed.

When we upgrade our CS-Cart version, will it delete this change? How do we make these changes and ensure they remain during upgrades

You would have to use the 'change_order_status' hook as discussed above.

In it, you would look for the $new_status being changed to 'P' and the $place_order parameter being true.

Then you would change the $new_status to 'O'.

Update: see retraction below.

When we upgrade our CS-Cart version, will it delete this change? How do we make these changes and ensure they remain during upgrades

Most possibly it will be lost. You can use the My changes module and the update_product_pre hook (app/functions/fn.catalog.php) to apply the changes correctly

Oops, my bad. I thought this was the trhead discussing order_status. Minor brain-fart.