3

ユーザー登録フォーラムのカスタムフィールドを追加する方法に関するドキュメントが見つからないため、何かを試しましたが、機能しませんでした。

<div class="single-full-width customer">
    <div class="login">
        {% form 'create_customer' %}
            {% if form.errors %}
                {% for field in form.errors %}
                    <p class="input-error-wrapper"><span>{{field}} {{ form.errors.messages[field] }}</span></p>
                {% endfor %}
            {% endif %}
            <p>
                <label>First Name:</label>
                <input type="text" value="" name="customer[first_name]" class="input-text-1" />
            </p>
            <p>
                <label>Last Name:</label>
                <input type="text" value="" name="customer[last_name]" class="input-text-1" />
            </p>
            <p>
                <label>Email Address:</label>
                <input type="text" value="" name="customer[email]" class="input-text-1" />
            </p>

            <p>
                <label>Password:</label>
                <input type="password" value="" name="customer[password]" class="input-text-1" />
            </p>

            <p>
                <label>Pet Name:</label>
                <input type="text" value="" name="customer[pet_name]" class="input-text-1" />

                <input type="radio" name="customer[pet]" value="cat">Cat
                <input type="radio" name="customer[pet]" value="dog">Dog
            </p>

            <p class="sign-in">
                <label></label>
                <a href="#" class="button-1 custom-font-1 trans-1 form-submit-btn"><span>Register</span></a>
                <b>or <a href="{{ shop.url }}">Return to store</a></b>
            </p>
        {% endform %}
    </div>

追加したフィールドは、テキスト入力(ペット名、Cat / Dogのラジオボックス)です。テストアカウントを使用しましたが、何も保存されないという出力が返されました。{{customer.pet_name}}を使用して保存された値を取得しようとしましたが、何も返されませんでした。助言がありますか?ありがとう!

4

1 に答える 1

2

ペットの名前をタグに保存するか、顧客用に存在するメモに保存します。pet_name は明らかに顧客フィールドではありません。

<p>
  <label>Pet Name:</label>
  <input type="text" value="" name="customer[note]" class="input-text-1" />
  <input type="radio" name="customer[tags]" value="cat">Cat
  <input type="radio" name="customer[tags]" value="dog">Dog
</p>
于 2013-03-17T13:59:36.073 に答える