How to disable products by default in Prestashop?

When Adding new product in Prestashop, you have to be careful to disable it if it's information not completed.

I tried to find a key in ps_configuration table, but there was nothing related to it, or at least I couldn't find it.

Now the question is how to disable product in Prestashop by default?


If you are using v1.7, there is the option "Default activation status" in Shop Parameters -> Product Settings.

If you are using an older version (1.6.x), try this override:

public function __construct($id_product = null, $full = false, $id_lang = null, $id_shop = null, Context $context = null)
    parent::__construct($id_product, $full, $id_lang, $id_shop, $context);
    if($id_product == null)
        $this->active = false;

When you add a new product the id_product is only set when saving.

EDIT: The above override doesn't always work because in the tpl, it checks if its associated to the current shop context, and it will always return false, because the product is not yet saved.

Instead, you can change/override the admin template file /admin/themes/default/template/controllers/products where the active switch is set (about line 196) change to:

<span class="switch prestashop-switch fixed-width-lg">
    <input onclick="toggleDraftWarning(false);showOptions(true);showRedirectProductOptions(false);" type="radio" name="active" id="active_on" value="1" {if $product->id != null && ( $product->active || !$product->isAssociatedToShop())}checked="checked" {/if} />
    <label for="active_on" class="radioCheck">
        {l s='Yes'}
    <input onclick="toggleDraftWarning(true);showOptions(false);showRedirectProductOptions(true);"  type="radio" name="active" id="active_off" value="0" {if $product->id == null || (!$product->active && $product->isAssociatedToShop())}checked="checked"{/if} />
    <label for="active_off" class="radioCheck">
        {l s='No'}
    <a class="slide-button btn"></a>

Adding the check for the $product->id.


 ? Woocommerce - Hook to set product weight on save_post
 ? Sort JIRA backlog by ticket# asc/DESC?
 ? Add Description to product
 ? Magento 2 Product Collection displays query
 ? Set website ID to 1 for all new products
 ? eigen3 arraywise matrix vector product for each column of matrix
 ? #VALUE! error when using SUMPRODUCT in excel 2010 and 2013
 ? Magento automatically deleting product
 ? Is there in prod() operator in gnuplot?
 ? How to display "Unit of Measure" field on Product form in Odoo 10?