2013-03-17 18 views
3

我無法找到如何添加自定義字段用戶註冊論壇的任何文件,所以我嘗試的東西,但沒有奏效:對Shopify用戶登記表的自定義字段

<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> 

我已經字段添加了文本輸入 - 寵物名稱和貓/狗的收音機。 我已經使用了一個測試帳戶,但輸出結果是沒有保存。我用{{customer.pet_name}}嘗試獲取保存的值,但沒有任何回報。 有什麼建議嗎?謝謝!

回答

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> 
+0

你能聯繫我一些如何做到這一點的信息?我找不到多少 – 2013-03-17 19:01:03

+0

完成..看我的代碼除了我的答案。 – 2013-03-18 00:13:25

+0

我討厭再次打擾你,但我怎樣才能返回值? {{customer.note}}和{{customer.cat}}? – 2013-03-18 16:34:30

相關問題