Post by amorfos33 » Wed Jan 22, 2020 6:21 pm

How to display custom fields in the client’s office? I list the fields, but there is no field value itself.

Newbie

Posts

Joined
Mon Dec 23, 2019 4:06 pm

Post by johnp » Wed Jan 22, 2020 9:16 pm

Works fine for me on my test site. Go back and check everything. Make sure you filled the value box in.

Opencart 1.5.6.5/OC Bootstrap Pro/VQMOD lover, user and geek.
Affordable Service £££ - Opencart Installs, Fixing, Development and Upgrades
Plus Ecommerce, Marketing, Mailing List Management and More
FREE Guidance and Advice at https://www.ecommerce-help.co.uk


User avatar
Active Member

Posts

Joined
Fri Mar 25, 2011 10:25 am
Location - Surrey, UK

Post by straightlight » Wed Jan 22, 2020 10:41 pm

OC version? Forum rules.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by amorfos33 » Thu Jan 23, 2020 4:11 pm

straightlight wrote:
Wed Jan 22, 2020 10:41 pm
OC version? Forum rules.
I'so sorry ! My version is 3.0.3.2. they are not displayed by default in the client's office.here is my code for output custom fields:
in common/accoun/account.php

Code: Select all

// Custom Fields
		$data['custom_fields'] = array();
		
		$this->load->model('account/custom_field');
		
		$custom_fields = $this->model_account_custom_field->getCustomFields(1);
		
		foreach ($custom_fields as $custom_field) {
			if ($custom_field['location'] == 'account') {
				$data['custom_fields'][] = $custom_field;
			}
		}
		
		if (isset($this->request->post['custom_field']['account'])) {
			$data['register_custom_field'] = $this->request->post['custom_field']['account'];
		} else {
			$data['register_custom_field'] = array();
		}
and in view/theme/account/account.twig

Code: Select all

 {% if custom_fields %}
               <fieldset>
                        {% for custom_field in custom_fields %}                  
                        {% if custom_field.location == 'account' %}
                        {% if custom_field.type == 'select' %}
                        <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order }}">
                          <label class="col-sm-2 control-label" for="input-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label>
                          <div class="col-sm-10">
                            <select name="custom_field[{{ custom_field.custom_field_id }}]" id="input-custom-field{{ custom_field.custom_field_id }}" class="form-control">
                              <option value="">{{ text_select }}</option>
                              {% for custom_field_value in custom_field.custom_field_value %}
                              {% if account_custom_field[custom_field.custom_field_id] and custom_field_value.custom_field_value_id == account_custom_field[custom_field.custom_field_id] %}
                              <option value="{{ custom_field_value.custom_field_value_id }}" selected="selected">{{ custom_field_value.name }}</option>
                              {% else %}
                              <option value="{{ custom_field_value.custom_field_value_id }}">{{ custom_field_value.name }}</option>
                              {% endif %}
                              {% endfor %}
                            </select>
                            {% if error_custom_field[custom_field.custom_field_id] %}
                            <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div>
                            {% endif %}</div>
                        </div>
                        {% endif %}
                        {% if custom_field.type == 'radio' %}
                        <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order }}">
                          <label class="col-sm-2 control-label">{{ custom_field.name }}</label>
                          <div class="col-sm-10">
                            <div> {% for custom_field_value in custom_field.custom_field_value %}
                              <div class="radio"> {% if account_custom_field[custom_field.custom_field_id] and custom_field_value.custom_field_value_id == account_custom_field[custom_field.custom_field_id] %}
                                <label>
                                  <input type="radio" name="custom_field[{{ custom_field.custom_field_id }}]" value="{{ custom_field_value.custom_field_value_id }}" checked="checked" />
                                  {{ custom_field_value.name }}</label>
                                {% else %}
                                <label>
                                  <input type="radio" name="custom_field[{{ custom_field.custom_field_id }}]" value="{{ custom_field_value.custom_field_value_id }}" />
                                  {{ custom_field_value.name }}</label>
                                {% endif %}</div>
                              {% endfor %} </div>
                            {% if error_custom_field[custom_field.custom_field_id] %}
                            <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div>
                            {% endif %}</div>
                        </div>
                        {% endif %}
                        {% if custom_field.type == 'checkbox' %}
                        <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order }}">
                          <label class="col-sm-2 control-label">{{ custom_field.name }}</label>
                          <div class="col-sm-10">
                            <div> {% for custom_field_value in custom_field.custom_field_value %}
                              <div class="checkbox">{% if account_custom_field[custom_field.custom_field_id] and custom_field_value.custom_field_value_id in account_custom_field[custom_field.custom_field_id] %}
                                <label>
                                  <input type="checkbox" name="custom_field[{{ custom_field.custom_field_id }}][]" value="{{ custom_field_value.custom_field_value_id }}" checked="checked" />
                                  {{ custom_field_value.name }}</label>
                                {% else %}
                                <label>
                                  <input type="checkbox" name="custom_field[{{ custom_field.custom_field_id }}][]" value="{{ custom_field_value.custom_field_value_id }}" />
                                  {{ custom_field_value.name }}</label>
                                {% endif %}</div>
                              {% endfor %}</div>
                            {% if error_custom_field[custom_field.custom_field_id] %}
                            <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div>
                            {% endif %}</div>
                        </div>
                        {% endif %}
                        {% if custom_field.type == 'text' %}
                        <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order }}">
                          <label class="col-sm-2 control-label" for="input-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label>
                          <div class="col-sm-10">
                            <input type="text" name="custom_field[{{ custom_field.custom_field_id }}]" 
                            value="{{ account_custom_field[custom_field.custom_field_id] ? account_custom_field[custom_field.custom_field_id] : custom_field.value }}" 
                            placeholder="{{ custom_field.name }}" id="input-custom-field{{ custom_field.custom_field_id }}" class="form-control" />
                            {% if error_custom_field[custom_field.custom_field_id] %}
                            <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div>
                            {% endif %}</div>
                        </div>
                        {% endif %}
                        {% if custom_field.type == 'textarea' %}
                        <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order }}">
                          <label class="col-sm-2 control-label" for="input-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label>
                          <div class="col-sm-10">
                            <textarea name="custom_field[{{ custom_field.custom_field_id }}]" rows="5" placeholder="{{ custom_field.name }}" id="input-custom-field{{ custom_field.custom_field_id }}" class="form-control">{{ account_custom_field[custom_field.custom_field_id] ? account_custom_field[custom_field.custom_field_id] : custom_field.value }}</textarea>
                            {% if error_custom_field[custom_field.custom_field_id] %}
                            <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div>
                            {% endif %}</div>
                        </div>
                        {% endif %}
                        {% if custom_field.type == 'file' %}
                        <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order }}">
                          <label class="col-sm-2 control-label">{{ custom_field.name }}</label>
                          <div class="col-sm-10">
                            <button type="button" id="button-custom-field{{ custom_field.custom_field_id }}" data-loading-text="{{ text_loading }}" class="btn btn-default"><i class="fa fa-upload"></i> {{ button_upload }}</button>
                            <input type="hidden" name="custom_field[{{ custom_field.custom_field_id }}]" value="{{ account_custom_field[custom_field.custom_field_id] ? account_custom_field[custom_field.custom_field_id] }}" id="input-custom-field{{ custom_field.custom_field_id }}" />
                            {% if error_custom_field[custom_field.custom_field_id] %}
                            <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div>
                            {% endif %}</div>
                        </div>
                        {% endif %}
                        {% if custom_field.type == 'date' %}
                        <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order }}">
                          <label class="col-sm-2 control-label" for="input-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label>
                          <div class="col-sm-10">
                            <div class="input-group date">
                              <input type="text" name="custom_field[{{ custom_field.custom_field_id }}]" value="{{ account_custom_field[custom_field.custom_field_id] ? account_custom_field[custom_field.custom_field_id] : custom_field.value }}" placeholder="{{ custom_field.name }}" data-date-format="YYYY-MM-DD" id="input-custom-field{{ custom_field.custom_field_id }}" class="form-control" />
                              <span class="input-group-btn">
                              <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
                              </span></div>
                            {% if error_custom_field[custom_field.custom_field_id] %}
                            <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div>
                            {% endif %}</div>
                        </div>
                        {% endif %}
                        {% if custom_field.type == 'time' %}
                        <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order }}">
                          <label class="col-sm-2 control-label" for="input-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label>
                          <div class="col-sm-10">
                            <div class="input-group time">
                              <input type="text" name="custom_field[{{ custom_field.custom_field_id }}]" value="{{ account_custom_field[custom_field.custom_field_id] ? account_custom_field[custom_field.custom_field_id] : custom_field.value }}" placeholder="{{ custom_field.name }}" data-date-format="HH:mm" id="input-custom-field{{ custom_field.custom_field_id }}" class="form-control" />
                              <span class="input-group-btn">
                              <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
                              </span></div>
                            {% if error_custom_field[custom_field.custom_field_id] %}
                            <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div>
                            {% endif %}</div>
                        </div>
                        {% endif %}
                        {% if custom_field.type == 'datetime' %}
                        <div class="form-group custom-field custom-field{{ custom_field.custom_field_id }}" data-sort="{{ custom_field.sort_order }}">
                          <label class="col-sm-2 control-label" for="input-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label>
                          <div class="col-sm-10">
                            <div class="input-group datetime">
                              <input type="text" name="custom_field[{{ custom_field.custom_field_id }}]" value="{{ account_custom_field[custom_field.custom_field_id] ? account_custom_field[custom_field.custom_field_id] : custom_field.value }}" placeholder="{{ custom_field.name }}" data-date-format="YYYY-MM-DD HH:mm" id="input-custom-field{{ custom_field.custom_field_id }}" class="form-control" />
                              <span class="input-group-btn">
                              <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
                              </span></div>
                            {% if error_custom_field[custom_field.custom_field_id] %}
                            <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div>
                            {% endif %}</div>
                        </div>
                        {% endif %}
                        {% endif %}
                        {% endfor %}
                      </fieldset>
              {% endif %}

Newbie

Posts

Joined
Mon Dec 23, 2019 4:06 pm

Post by johnp » Thu Jan 23, 2020 5:29 pm

They're not supposed to be displayed by default. You have to create them then enable them. PM me and I'll let you have access to my demo site so you can see how they work. :)

Opencart 1.5.6.5/OC Bootstrap Pro/VQMOD lover, user and geek.
Affordable Service £££ - Opencart Installs, Fixing, Development and Upgrades
Plus Ecommerce, Marketing, Mailing List Management and More
FREE Guidance and Advice at https://www.ecommerce-help.co.uk


User avatar
Active Member

Posts

Joined
Fri Mar 25, 2011 10:25 am
Location - Surrey, UK

Post by amorfos33 » Sat Jan 25, 2020 12:54 am

johnp wrote:
Thu Jan 23, 2020 5:29 pm
They're not supposed to be displayed by default. You have to create them then enable them. PM me and I'll let you have access to my demo site so you can see how they work. :)
that is the case that they were created. and they are in the database. in the admin section in the Clients section. when I see customer information, the fields are displayed and relevant.

Newbie

Posts

Joined
Mon Dec 23, 2019 4:06 pm

Post by straightlight » Mon Jan 27, 2020 2:55 am

This type of issue has been reported on Github Opencart already. See this discussion: https://github.com/opencart/opencart/issues/7533 .

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by rale » Sat Feb 03, 2024 4:29 am

straightlight wrote:
Mon Jan 27, 2020 2:55 am
This type of issue has been reported on Github Opencart already. See this discussion: https://github.com/opencart/opencart/issues/7533 .
The person asks how to display and why the customized fields are not displayed for the user on the account, and you send it to a third topic. Why are you always rude and always pretending to be smart?

User avatar
New member

Posts

Joined
Sun Apr 17, 2016 1:44 am

Post by straightlight » Sat Feb 03, 2024 5:54 am

rale wrote:
Sat Feb 03, 2024 4:29 am
straightlight wrote:
Mon Jan 27, 2020 2:55 am
This type of issue has been reported on Github Opencart already. See this discussion: https://github.com/opencart/opencart/issues/7533 .
The person asks how to display and why the customized fields are not displayed for the user on the account, and you send it to a third topic. Why are you always rude and always pretending to be smart?
4 years later to post about an old reply that's been solved a long time ago instead of creating a new topic.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by rale » Sat Feb 10, 2024 2:34 am

straightlight wrote:
Sat Feb 03, 2024 5:54 am
rale wrote:
Sat Feb 03, 2024 4:29 am
straightlight wrote:
Mon Jan 27, 2020 2:55 am
This type of issue has been reported on Github Opencart already. See this discussion: https://github.com/opencart/opencart/issues/7533 .
The person asks how to display and why the customized fields are not displayed for the user on the account, and you send it to a third topic. Why are you always rude and always pretending to be smart?
4 years later to post about an old reply that's been solved a long time ago instead of creating a new topic.
But no one answered the question for 4 years. As for you, I have noticed on numerous topics on the forum that when people ask for something, you write codes for something completely different or simply ignore them with some information about the rules. I'm sorry, but I think that the basic things that other programmers charge a lot of money for are being overlooked. And there is no answer on the forum for this question yet and we all follow your post and remain confused. In any case, thanks for the answer.

User avatar
New member

Posts

Joined
Sun Apr 17, 2016 1:44 am

Post by straightlight » Mon Feb 12, 2024 3:50 am

rale wrote:
Sat Feb 10, 2024 2:34 am
straightlight wrote:
Sat Feb 03, 2024 5:54 am
rale wrote:
Sat Feb 03, 2024 4:29 am

The person asks how to display and why the customized fields are not displayed for the user on the account, and you send it to a third topic. Why are you always rude and always pretending to be smart?
4 years later to post about an old reply that's been solved a long time ago instead of creating a new topic.
But no one answered the question for 4 years. As for you, I have noticed on numerous topics on the forum that when people ask for something, you write codes for something completely different or simply ignore them with some information about the rules. I'm sorry, but I think that the basic things that other programmers charge a lot of money for are being overlooked. And there is no answer on the forum for this question yet and we all follow your post and remain confused. In any case, thanks for the answer.
Off-topic. It hasn't been answered for 4 years, then why would anyone want to catch up what's been left off 4 years ago while new topics could rather be created. As for the confusion, it's simply related from the people that are able to read between the lines.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by rale » Tue Feb 13, 2024 5:34 pm

straightlight wrote:
Mon Feb 12, 2024 3:50 am
rale wrote:
Sat Feb 10, 2024 2:34 am
straightlight wrote:
Sat Feb 03, 2024 5:54 am


4 years later to post about an old reply that's been solved a long time ago instead of creating a new topic.
But no one answered the question for 4 years. As for you, I have noticed on numerous topics on the forum that when people ask for something, you write codes for something completely different or simply ignore them with some information about the rules. I'm sorry, but I think that the basic things that other programmers charge a lot of money for are being overlooked. And there is no answer on the forum for this question yet and we all follow your post and remain confused. In any case, thanks for the answer.
Off-topic. It hasn't been answered for 4 years, then why would anyone want to catch up what's been left off 4 years ago while new topics could rather be created. As for the confusion, it's simply related from the people that are able to read between the lines.
Ok, lets we ON-topic again.
Why is problem to provide some codes for show customer basic info from main account in account page? OC need to have after 10 year basic info customer when customer go to own main account.
How we can show first name, last name , company name, customer id, email, telephone , address and group on main customer account page and why not?

User avatar
New member

Posts

Joined
Sun Apr 17, 2016 1:44 am
Who is online

Users browsing this forum: No registered users and 5 guests