Post by spstore » Wed May 29, 2024 7:12 am

Hello,

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

custom_field empty values.jpg

The custom_field column on oc_customer table - custom_field empty values.jpg (15.17 KiB) Viewed 1232 times

modified order_info page.png

This is the correct view when values really exist. - modified order_info page.png (32.37 KiB) Viewed 1232 times

emtpy_custom_fields.jpg

This is the result when there are empty strings on the database. Empty custom_fields table. - emtpy_custom_fields.jpg (70.6 KiB) Viewed 1232 times


Newbie

Posts

Joined
Sat Aug 26, 2023 8:14 pm

Post by IP_CAM » Wed May 29, 2024 5:54 pm

Well, you're using a commercial Journal Theme Extension, not supported in the 'free' Opencart Forum, you therefore better post in the commercal OC Forum, if you expect someone to be of assistance. Or then, use the official Journal User Forum, to get some help.

My Github OC Site: https://github.com/IP-CAM
5'300 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by spstore » Thu May 30, 2024 5:50 am

IP_CAM wrote:
Wed May 29, 2024 5:54 pm
Well, 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.
Thanks for your reply.

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.

Newbie

Posts

Joined
Sat Aug 26, 2023 8:14 pm

Post by ADD Creative » Fri May 31, 2024 4:19 am

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

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by spstore » Sat Jun 08, 2024 1:33 am

ADD Creative wrote:
Fri May 31, 2024 4:19 am
If 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.
Thanks for your reply.

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?

Newbie

Posts

Joined
Sat Aug 26, 2023 8:14 pm

Post by ADD Creative » Sun Jun 09, 2024 7:01 am

Yes 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'],

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by OSWorX » Sun Jun 09, 2024 5:13 pm

ADD Creative wrote:
Sun Jun 09, 2024 7:01 am
Yes 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'],
Should'nt that also be an "issue" for the core?

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by IP_CAM » Mon Jun 10, 2024 5:07 pm

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.
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) ? :crazy:
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'300 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland
Who is online

Users browsing this forum: No registered users and 36 guests