2017-06-16 60 views
-3

如何使checkstopop 1.7中的默认选项卡在checkout过程中被选中?如何在结账过程中在prestashop 1.7中默认选中通讯复选框?

enter image description here

更新: 我发现那里的形式rendrered文件: \模块\ ps_emailsubscription \ ps_emailsubscription.php

但是足够惊人有定义没有改变属性的功能。

public function hookAdditionalCustomerFormFields($params) 
{ 
    $label = $this->trans(
     'Sign up for our newsletter[1][2]%conditions%[/2]', 
     array(
      '[1]' => '<br>', 
      '[2]' => '<em>', 
      '%conditions%' => Configuration::get('NW_CONDITIONS', $this->context->language->id), 
      '[/2]' => '</em>', 
     ), 
     'Modules.Emailsubscription.Shop' 
    ); 

    return array(
     (new FormField()) 
      ->setName('newsletter') 
      ->setType('checkbox') 
      ->setLabel($label)); 
} 

回答

1

正在呈现形式正确的文件是:

/themes/[your-activated-theme]/templates/customer/_partials/customer_form.tpl

在第32行你可以看到这个代码是RESPONSABLE来渲染表单的输入域:

{block "form_fields"} 
    {foreach from=$formFields item="field"} 
    {block "form_field"} 
     {form_field field=$field} 
    {/block} 
    {/foreach} 
    {$hook_create_account_form nofilter} 
{/block} 

新的方法来创建表单域被调用函数的Smarty“{} form_field”,欲行35 这个函式调用此文件来创建不同的输入的:

/themes/[your-activated-theme]/templates/_partials/form-fields.tpl

所以,我更快的解决方案(我认为这不是最好的,但工作)是直接在这个文件中更改,说当它是时事通讯和optin输入,并且它在验证页面时,检查复选框输入:

在form-fileds .tpl文件:

{if $field.value)} 

收件人:

{if $field.value || ($field.name == "newsletter" && $page.page_name == 'authentication') || ($field.name == "optin" && $page.page_name == 'authentication')} 

希望它可以帮助你。

0

我以前的答案没有工作,所以我只是改变了:

{if $field.value}checked="checked"{/if}

到:

checked="checked"

的问候, B

相关问题