account/edit-profile

Trang sửa thông tin cá nhân.

Ngoài những biến dưới đây, slot này còn nhận toàn bộ biến toàn cục.

Biến của trang

Biến Kiểu Mô tả Từ phiên bản
customer Customer Hồ sơ khách đang đăng nhập. 1.0
error_message string | null Thông báo lỗi khi lưu thất bại. 1.0
success_message string | null Thông báo khi lưu thành công. 1.0

Mã đầy đủ

Toàn bộ tệp account/edit-profile.html của bộ giao diện mặc định. Chép về templates/<bộ giao diện của bạn>/account/edit-profile.html rồi sửa theo ý muốn.

<div class="container page-content">
  <h1 class="page-title">Thông tin cá nhân</h1>
  <div class="account-layout">
    {% assign active_page = 'profile' %}
    {% include 'account/_sidebar' %}
    <div class="account-main">
      {% if success_message %}
        <div class="alert alert--success">{{ success_message }}</div>
      {% endif %}
      {% if error_message %}
        <div class="alert alert--error">{{ error_message }}</div>
      {% endif %}

      <form action="/tai-khoan/thong-tin" method="post" class="account-form">
        <div style="position:absolute;left:-9999px;top:-9999px" aria-hidden="true">
          <label for="_hp">Leave this field empty</label>
          <input type="text" id="_hp" name="_hp" tabindex="-1" autocomplete="off">
        </div>

        <div class="form-row">
          <div class="form-group">
            <label for="first_name">Họ *</label>
            <input type="text" id="first_name" name="first_name" required class="form-input"
                   value="{{ customer.first_name }}">
          </div>
          <div class="form-group">
            <label for="last_name">Tên *</label>
            <input type="text" id="last_name" name="last_name" required class="form-input"
                   value="{{ customer.last_name }}">
          </div>
        </div>

        <div class="form-group">
          <label for="phone">Số điện thoại</label>
          <input type="tel" id="phone" name="phone" class="form-input"
                 value="{{ customer.phone }}">
        </div>

        <div class="form-group form-group--checkbox">
          <label class="checkbox-label">
            <input type="checkbox" name="accepts_marketing" value="1"
                   {% if customer.accepts_marketing %}checked{% endif %}>
            Nhận thông tin khuyến mãi qua email
          </label>
        </div>

        <button type="submit" class="btn btn--primary">Lưu thay đổi</button>
      </form>
    </div>
  </div>
</div>