Post by piyushvisaria » Sat Mar 19, 2022 6:50 pm

Correction !.. the custom field under affiliate --- under personal information -- the data gets saved, but custom field -- under affiliate information -- the data does not get saved. i checked the database, there is no information stored...

New member

Posts

Joined
Thu Mar 03, 2022 8:04 pm

Post by straightlight » Sat Mar 19, 2022 9:19 pm

piyushvisaria wrote:
Sat Mar 19, 2022 6:50 pm
Correction !.. the custom field under affiliate --- under personal information -- the data gets saved, but custom field -- under affiliate information -- the data does not get saved. i checked the database, there is no information stored...
What database information did you checked?

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 piyushvisaria » Sun Mar 20, 2022 2:04 am

I went to oc_customer --- search by firstname --- i get the results -- the databse results doesnot show any data from the custom field added from affiliate information. it only shows the data added from accounts - affiliate.. also when i go to oc_customer_affiliate --- search by customer id -- the results doesnot show any custom fields.

i tried all the possible outcomes -- links you shared but not able to see any data...

I request you to kindly look into this as priority. and if possible revert it as soon as possible, there are lot of activity I need to perform on my site with respect to affiliates..

Thank you & Regards.

New member

Posts

Joined
Thu Mar 03, 2022 8:04 pm

Post by mikeinterserv » Sun Mar 20, 2022 3:07 am

If you look at catalog/model/account/customer php You will see public function edit customer. In the update query you will see the custom fields code.
In the public function edit affiliate UPDATE query it is entirely missing and there is no way the data can be saved from a custom field.

Active Member

Posts

Joined
Thu May 28, 2020 6:55 am
Location - Wales

Post by straightlight » Sun Mar 20, 2022 3:29 am

Confirmed, also found on the Maintenance Branch. Pull request created: https://github.com/opencart/opencart/pull/10490 . Well done!

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 mikeinterserv » Sun Mar 20, 2022 3:35 am

In catalog/model/account/customer.php - Line 138 public function edit affiliate Replace:

Code: Select all

$this->db->query("UPDATE " . DB_PREFIX . "customer_affiliate SET `company` = '" . $this->db->escape($data['company']) . "', `website` = '" . $this->db->escape($data['website']) . "', `commission` = '" . (float)$this->config->get('config_affiliate_commission') . "', `tax` = '" . $this->db->escape($data['tax']) . "', `payment` = '" . $this->db->escape($data['payment']) . "', `cheque` = '" . $this->db->escape($data['cheque']) . "', `paypal` = '" . $this->db->escape($data['paypal']) . "', `bank_name` = '" . $this->db->escape($data['bank_name']) . "', `bank_branch_number` = '" . $this->db->escape($data['bank_branch_number']) . "', `bank_swift_code` = '" . $this->db->escape($data['bank_swift_code']) . "', `bank_account_name` = '" . $this->db->escape($data['bank_account_name']) . "', `bank_account_number` = '" . $this->db->escape($data['bank_account_number']) . "' WHERE `customer_id` = '" . (int)$customer_id . "'");
.
With

Code: Select all

$this->db->query("UPDATE " . DB_PREFIX . "customer_affiliate SET `company` = '" . $this->db->escape($data['company']) . "', `website` = '" . $this->db->escape($data['website']) . "', `commission` = '" . (float)$this->config->get('config_affiliate_commission') . "', `tax` = '" . $this->db->escape($data['tax']) . "', `payment` = '" . $this->db->escape($data['payment']) . "', `cheque` = '" . $this->db->escape($data['cheque']) . "', `paypal` = '" . $this->db->escape($data['paypal']) . "', `bank_name` = '" . $this->db->escape($data['bank_name']) . "', `bank_branch_number` = '" . $this->db->escape($data['bank_branch_number']) . "', `bank_swift_code` = '" . $this->db->escape($data['bank_swift_code']) . "', `bank_account_name` = '" . $this->db->escape($data['bank_account_name']) . "', `bank_account_number` = '" . $this->db->escape($data['bank_account_number']) . "', custom_field = '" . $this->db->escape(isset($data['custom_field']['affiliate']) ? json_encode($data['custom_field']['affiliate']) : json_encode(array()))  . "' WHERE `customer_id` = '" . (int)$customer_id . "'");
It seems code was added to affiliate add function on maintenance branch but NOT affiliate EDIT.
Everything else re custom fields is in place and working. So if you replace this code its fixed and your good to go :-)

Active Member

Posts

Joined
Thu May 28, 2020 6:55 am
Location - Wales

Post by xxvirusxx » Sun Mar 20, 2022 4:02 pm

mikeinterserv wrote:
Sun Mar 20, 2022 3:35 am
It seems code was added to affiliate add function on maintenance branch but NOT affiliate EDIT.
I forgot about edit function when I made pull request :laugh:

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by piyushvisaria » Sun Mar 20, 2022 4:41 pm

Till Now no success.. The problem lies when entering the data in the custom fields under affiliate information [front end]--- this data does not get stored in the database.

New member

Posts

Joined
Thu Mar 03, 2022 8:04 pm

Post by xxvirusxx » Sun Mar 20, 2022 6:26 pm

You have refreshed OCMod Modification, Cleared Theme cache, SASS cache?

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by piyushvisaria » Sun Mar 20, 2022 9:00 pm

I have made a screen recording of the issue i am facing in version 3.8. I have uploaded in youtube and is unlisted.
[youtube]https://www.youtube.com/watch?v=w6nwSzoqqHY[/youtube]

Let me know if you have any queries on this.. i will be happy to share with you.

New member

Posts

Joined
Thu Mar 03, 2022 8:04 pm

Post by xxvirusxx » Sun Mar 20, 2022 9:15 pm

Last edited by xxvirusxx on Sun Mar 20, 2022 11:04 pm, edited 3 times in total.

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by mikeinterserv » Sun Mar 20, 2022 10:53 pm

xxvirusxx wrote:
Sun Mar 20, 2022 4:02 pm
mikeinterserv wrote:
Sun Mar 20, 2022 3:35 am
It seems code was added to affiliate add function on maintenance branch but NOT affiliate EDIT.
I forgot about edit function when I made pull request :laugh:
Yeah I saw the links you gave and they hit every target except edit affilliate. Just bad luck :-)
I imagine the OP has messed something else up as the custom fields now work perfectly changing that line.

Active Member

Posts

Joined
Thu May 28, 2020 6:55 am
Location - Wales

Post by mikeinterserv » Sun Mar 20, 2022 10:57 pm

piyushvisaria wrote:
Sun Mar 20, 2022 4:41 pm
Till Now no success.. The problem lies when entering the data in the custom fields under affiliate information [front end]--- this data does not get stored in the database.
Yes and you have now been provided with the fix. If it doesn't work you have messed something else up.

Active Member

Posts

Joined
Thu May 28, 2020 6:55 am
Location - Wales

Post by xxvirusxx » Sun Mar 20, 2022 11:02 pm

mikeinterserv wrote:
Sun Mar 20, 2022 10:53 pm
Yeah I saw the links you gave and they hit every target except edit affilliate. Just bad luck :-)
And more bugs :laugh:

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by mikeinterserv » Sun Mar 20, 2022 11:45 pm

There is MORE
The ADMIN does NOT pick up the affiliate field as shown in the OP video. I can confirm that also.
It could be line 49 of admin/model/customer/customer.php - Not sure if that is one of the fixes given.

Active Member

Posts

Joined
Thu May 28, 2020 6:55 am
Location - Wales

Post by xxvirusxx » Sun Mar 20, 2022 11:55 pm

Yes.

Updating customer_form.twig and changed in model (line 49)

Code: Select all

custom_field = '" . $this->db->escape(isset($data['custom_field']['affiliate']) ? json_encode($data['custom_field']['affiliate']) : json_encode(array())) . "'
In to this

Code: Select all

`custom_field` = '" . $this->db->escape(isset($data['custom_field']) ? json_encode($data['custom_field']) : json_encode(array())) . "'
Wil fix OP issue.

But strange thing is if you edit a customer, Affiliate tab and change value from afilliate custom field in database is inserted

Code: Select all

{"2":"","1":"value_for"}
When should be

Code: Select all

{1":"value_for"}

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by mikeinterserv » Mon Mar 21, 2022 12:33 am

xxvirusxx wrote:
Sun Mar 20, 2022 11:55 pm
But strange thing is if you edit a customer, Affiliate tab and change value from afilliate custom field in database is inserted

Code: Select all

{"2":"","1":"value_for"}
When should be

Code: Select all

{1":"value_for"}
Yes that's right. I thought it was fixed because the OP said FRONT END so I only looked at front end. that WORKS NOW. I didn't check the admin edit.
Line 631 in admin/view/template/customer/customer_form.twig is getting the WRONG VALUE Its getting its value from the custom field table and NOT CUSTOMER AFFILIATE TABLE which it should no ?

Active Member

Posts

Joined
Thu May 28, 2020 6:55 am
Location - Wales

Post by straightlight » Mon Mar 21, 2022 1:11 am

After all this time these issues were there ... that's messed up.

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 straightlight » Mon Mar 21, 2022 1:22 am

mikeinterserv wrote:
Mon Mar 21, 2022 12:33 am
xxvirusxx wrote:
Sun Mar 20, 2022 11:55 pm
But strange thing is if you edit a customer, Affiliate tab and change value from afilliate custom field in database is inserted

Code: Select all

{"2":"","1":"value_for"}
When should be

Code: Select all

{1":"value_for"}
Yes that's right. I thought it was fixed because the OP said FRONT END so I only looked at front end. that WORKS NOW. I didn't check the admin edit.
Line 631 in admin/view/template/customer/customer_form.twig is getting the WRONG VALUE Its getting its value from the custom field table and NOT CUSTOMER AFFILIATE TABLE which it should no ?
Yes, by looking at this code, it should.

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 mikeinterserv » Mon Mar 21, 2022 1:27 am

This whole thing is a disaster.
When you save in CUSTOMER affiliate EDIT in front end it saves custom field to DB in CUSTOMER AFFILIATE TABLE.
When you save from ADMIN it saves custom field VALUE in the CUSTOMER table.
NEITHER can be READ in ADMIN EDIT.
It is hard to follow code and might drive you mad.
To the customer all appears well and the custom field is READ and SAVED as expected.
However in ADMIN the NEW VALUE is NOT read and the same occurs, you can edit in admin and the data is saved and all appears well, until you go to FRONT END and see the DATA are now COMPLETELY DIFFERENT - ADMIN saves ADMIN and customer SAVES CUSTOMER with NO interaction between.

Active Member

Posts

Joined
Thu May 28, 2020 6:55 am
Location - Wales
Who is online

Users browsing this forum: Google [Bot] and 18 guests