I am relatively new to opencart but i am trying to adjust it to my needs.
My OC version is 3.0.3.8 with Journal theme.
I am trying to bring the custom_fields to a visible part of the order info page instead of searching it through the "Additional" tab so my employees can clearly see if there is any additional information (ex. VAT. No., etc)
I managed to modify the /admin/view/template/sale/order_info.twig so if there are values it brings the custom_field tab to the front place. (check screenshot).
The problem is that when a customer is registered, OC stores some empty stings on the custom_field column in the oc_customer table even if there aren't any available custom fields for his group. (ex. "Receipt" instead of "Commercial Invoice").
For example, the custom_field cell contains empty stings: {"19":"","20":""} when the custom fields are not in use as the customer belongs to the "Receipt" group, that doesn't require any extra info-fields.
This result is to show an empty table without values. (check screenshot)
I would like to know how can I fix this and remove these empty strings when a customer is registered so my modification could work properly without showing empty tables.
Or
If there is a way to exclude empty strings by modifying the twig template.
Extra info:
1)I am not yet a developer.
2)The twig variable that I use to display or not the custom fields is: {% if account_custom_fields %} / {% if not account_custom_fields %}
3) Journal registration form doesn't affect it.
4) If the customer is not registered the custom_field remains empty.
Thanks in advance
Attachments
The custom_field column on oc_customer table - custom_field empty values.jpg (15.17 KiB) Viewed 1611 times
This is the correct view when values really exist. - modified order_info page.png (32.37 KiB) Viewed 1611 times
This is the result when there are empty strings on the database. Empty custom_fields table. - emtpy_custom_fields.jpg (70.6 KiB) Viewed 1611 times
My Github OC Site: https://github.com/IP-CAM
5'600 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
Thanks for your reply.IP_CAM wrote: ↑Wed May 29, 2024 5:54 pmWell, you're using a commercial Journal Theme Extension, not supported in the 'free' Opencart Forum, you therefore better post in the commercial OC Forum, if you expect someone to be of assistance. Or then, use the official Journal User Forum, to get some help.
I thought that someone could help since this is not really related with Journal theme and has to do with the backend and the default code.
Actually, I am using the default theme for the test now since I also thought that there may be an issue with journals registration form, but its not.
The same issue exists with the default theme.
I know that most of the developers hate Journal but this is not a reason for ignoring an issue that is not related with Journal.
Thanks for your reply.ADD Creative wrote: ↑Fri May 31, 2024 4:19 amIf a custom field is not enabled for a customer group then no data should be stored. I think the issue maybe if the a customer changes group or the custom fields are removed from a from a group.
That's what I thought also. But this issue existed from the beginning as I checked the database entries. When a customer is registered to the "RECEIPT" group that there is no custom field added for VAT number in the database adds an entry like {"19":""}. So actually inserts an empty string (as I understand).
In the admin panel obviously there is no value displayed but activates the "Additional" Tab.
So in this case I want to find a way to ignore empty stings and don't activate the "Additional" Tab or I don't know if there is a way to correct this issue and change the code and fix this so there will not be at all entries in groups without custom fields when a customer is registered.
Any suggestions?
The bit of code you may want to change is.
https://github.com/opencart/opencart/bl ... 1042-L1047
You could try filtering by customer_group_id.
Code: Select all
'filter_customer_group_id' => $order_info['customer_group_id'],
Should'nt that also be an "issue" for the core?ADD Creative wrote: ↑Sun Jun 09, 2024 7:01 amYes I see what you mean, if another group has a field it will be saved for all groups.
The bit of code you may want to change is.
https://github.com/opencart/opencart/bl ... 1042-L1047
You could try filtering by customer_group_id.Code: Select all
'filter_customer_group_id' => $order_info['customer_group_id'],
Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.
Well, the main problem is the plain Fact, that most Journal Theme Users, coming here for Support, do not use a 'legal' Journal Copy, but a 'stolen' one, and therefore cannot use the official Journal Support, if they run into a Problem. And why should they then be assisted (for free) ?I know that most of the developers hate Journal but this is not a reason for ignoring an issue that is not related with Journal.
![Crazy :crazy:](./images/smilies/crazy_mini.gif)
So better don't take it personal, if you don't belong to them, but understand the situation, as it exists.
My Github OC Site: https://github.com/IP-CAM
5'600 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
Users browsing this forum: No registered users and 19 guests