Page 1 of 3

Custom Fields do not get stored

Posted: Wed Mar 16, 2022 3:52 pm
by piyushvisaria
Hi,
I have added custom fields like date, text and upload under affiliate section. I can see these fields under the affiliate registration form. After the user has registered as affiliate, under the admin - customer, i do not see the data filled by the user. although i can see the fields but they are empty.

Thankyou for your support.

Re: Custom Fields do not get stored

Posted: Wed Mar 16, 2022 7:53 pm
by straightlight
OC version.

Re: Custom Fields do not get stored

Posted: Wed Mar 16, 2022 9:59 pm
by piyushvisaria
OC version 3.0.3.7

Re: Custom Fields do not get stored

Posted: Wed Mar 16, 2022 10:05 pm
by straightlight
See this fix that is related to the orders: https://github.com/opencart/opencart/pu ... 83eac4e356 . Perhaps the same fix can be applied with the customer controllers, AFAIK, when loading the custom fields (and if there aren't any commits already reported about it already).

Re: Custom Fields do not get stored

Posted: Thu Mar 17, 2022 12:46 pm
by piyushvisaria
actually, i tried lot of different options but nothing seems to be working. Can you please help me like on which files [path] should i apply these changes...

Thank you for the reply.

Re: Custom Fields do not get stored

Posted: Thu Mar 17, 2022 8:03 pm
by piyushvisaria
I modified the files, as per the code given above, but i get validation errors. screenshot attached...

Re: Custom Fields do not get stored

Posted: Thu Mar 17, 2022 8:59 pm
by straightlight
Which PHP version?

Re: Custom Fields do not get stored

Posted: Fri Mar 18, 2022 12:14 am
by piyushvisaria
I have tried on both 7.4.12 and 8

Re: Custom Fields do not get stored

Posted: Fri Mar 18, 2022 3:19 am
by straightlight
piyushvisaria wrote:
Fri Mar 18, 2022 12:14 am
I have tried on both 7.4.12 and 8
Please provide your recent Server Error Logs about this page.

Re: Custom Fields do not get stored

Posted: Fri Mar 18, 2022 3:06 pm
by piyushvisaria
There are no server logs as i am working on local system.. also i noticed one more thing. first the data does not get reflected in the admin and also if i reenter the data in the custom fields from admin and save it.. the data doesnot get stored. so either from front end or from admin panel - the custom fields under the affiliate does not get stored.. I also tried with the fresh install.. the problem still persists ..

Re: Custom Fields do not get stored

Posted: Fri Mar 18, 2022 3:41 pm
by xxvirusxx

Re: Custom Fields do not get stored

Posted: Fri Mar 18, 2022 9:07 pm
by piyushvisaria
I believe from the front end once the customer fills the data in the custom field under affiliate, there is no database entry. I checked the database [custom field] its seems to be empty...

Re: Custom Fields do not get stored

Posted: Fri Mar 18, 2022 10:50 pm
by straightlight
In admin/controller/customer/affiliate.php file,

in the validateForm() method, find:

Code: Select all

if ((utf8_strlen($this->request->post['firstname']) < 1) || (utf8_strlen(trim($this->request->post['firstname'])) > 32)) {
add above:

Code: Select all

echo "<pre />\n";
print_r($this->request->post);
exit;
Then, try again on the page to edit your information. Once the form gets submitted, you should notice an array in the next page. Please post the results afterwards.

Re: Custom Fields do not get stored

Posted: Fri Mar 18, 2022 11:14 pm
by piyushvisaria
Hi,
i do not see affiliate.php file under admin/controller/customer

Screen shot attached.

Re: Custom Fields do not get stored

Posted: Fri Mar 18, 2022 11:25 pm
by piyushvisaria
I got the array. actually affiliate file is no there, its customer.php.

I can see the information in the array, but thats after i have edited the customer details under the admin section. When users first registers as affiliate and enters the data. under admin -- >the data for default fields is there but the for custom fields its missing.


heres the array.
Array
(
[customer_group_id] => 1
[firstname] => ppppppp
[lastname] => ppppppp
[email] => admin@12dfdf.com
[telephone] => 122323
[password] =>
[confirm] =>
[newsletter] => 0
[status] => 1
[safe] => 0
[seller] => 1
[company] => 121212
[custom_field] => Array
(
[2] => 1
[1] => 2121-02-01
[3] =>
[4] =>
[5] =>
[6] => dsdsd
)

[website] => dsf
[tracking] => L5Mou70xifA6TqdbjbfSSfXQKujORNMHgqhkEidj3S9qeAWhkY4mMKqQMRwgRZI9
[commission] => 5.00
[tax] => dsfdfs
[payment] => cheque
[cheque] => dsfdsf
[paypal] =>
[bank_name] =>
[bank_branch_number] =>
[bank_swift_code] =>
[bank_account_name] =>
[bank_account_number] =>
[affiliate] => 1
[comment] =>
[description] =>
[amount] =>
[points] =>
[kbmp_default_commission] =>
[kbmp_default_commission_global] => 1
[kbmp_new_product_approval_required] => 0
[kbmp_new_product_approval_required_global] => 1
[kbmp_enable_seller_review] => 0
[kbmp_enable_seller_review_global] => 1
[kbmp_seller_review_approval_required] => 0
[kbmp_seller_review_approval_required_global] => 1
[kbmp_email_on_new_order] => 0
[kbmp_email_on_new_order_global] => 1
[category] =>
)

Re: Custom Fields do not get stored

Posted: Sat Mar 19, 2022 12:17 am
by straightlight
Extensions involved.

Re: Custom Fields do not get stored

Posted: Sat Mar 19, 2022 1:47 pm
by piyushvisaria
Sir, Without the extensions also i am facing issue. I did the fresh install of 3.8, the problem still persists... and the issue is only under affiliate. custom fields are working fine with account, registration..

Re: Custom Fields do not get stored

Posted: Sat Mar 19, 2022 1:54 pm
by piyushvisaria
Heres the screen shot... the custom fields under affiliate are not showing any data - -- admin - customer ---affiliate. opencart 3.8

Re: Custom Fields do not get stored

Posted: Sat Mar 19, 2022 3:53 pm
by xxvirusxx
piyushvisaria wrote:
Sat Mar 19, 2022 1:54 pm
admin - customer ---affiliate. opencart 3.8
You have changed in to this??
https://github.com/opencart/opencart/co ... 6e9fe0acb4

Re: Custom Fields do not get stored

Posted: Sat Mar 19, 2022 4:33 pm
by piyushvisaria
Its not working...