如何在Prestashop中默认禁用产品?

如何在Prestashop中默认禁用产品?,prestashop,product,Prestashop,Product,在Prestashop中添加新产品时,如果信息未完成,则必须小心禁用它 我试图在ps\u配置表中找到一个键,但与之无关,或者至少我找不到它 现在的问题是,默认情况下如何在Prestashop中禁用产品?如果您使用的是v1.7,则在Shop Parameters->product Settings中有“default activation status”(默认激活状态)选项 如果您使用的是旧版本(1.6.x),请尝试以下替代: public function __construct($id_pro

在Prestashop中添加新产品时,如果信息未完成,则必须小心禁用它

我试图在
ps\u配置
表中找到一个键,但与之无关,或者至少我找不到它


现在的问题是,默认情况下如何在Prestashop中禁用产品?

如果您使用的是v1.7,则在Shop Parameters->product Settings中有“default activation status”(默认激活状态)选项

如果您使用的是旧版本(1.6.x),请尝试以下替代:

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;
}
添加新产品时,仅在保存时设置id_产品

编辑:上面的覆盖并不总是有效的,因为在tpl中,它检查其是否与当前商店上下文关联,并且它总是返回false,因为产品尚未保存

相反,您可以将设置了活动开关的管理模板文件/admin/themes/default/template/controllers/products(关于第196行)更改为:

<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'}
    </label>
    <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'}
    </label>
    <a class="slide-button btn"></a>
</span>

身份证!=null&&($product->active | |!$product->isAssociatedToShop())checked=“checked”{/if}/>
{l s='Yes'}
id==null | |(!$product->active&&$product->isAssociatedToShop())checked=“checked”{/if}/>
{l s='No'}

添加对$product->id的检查。

如果您使用的是v1.7,则在“车间参数->产品设置”中有“默认激活状态”选项

如果您使用的是旧版本(1.6.x),请尝试以下替代:

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;
}
添加新产品时,仅在保存时设置id_产品

编辑:上面的覆盖并不总是有效的,因为在tpl中,它检查其是否与当前商店上下文关联,并且它总是返回false,因为产品尚未保存

相反,您可以将设置了活动开关的管理模板文件/admin/themes/default/template/controllers/products(关于第196行)更改为:

<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'}
    </label>
    <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'}
    </label>
    <a class="slide-button btn"></a>
</span>

身份证!=null&&($product->active | |!$product->isAssociatedToShop())checked=“checked”{/if}/>
{l s='Yes'}
id==null | |(!$product->active&&$product->isAssociatedToShop())checked=“checked”{/if}/>
{l s='No'}
添加$product->id的检查