Post by webs_bd » Sat Apr 07, 2018 12:44 am

version 3.0.2.0.
I have successfully created a Custom Field in Customers. This shows in registration page but when filled out as a customer it does not save. Also the field is not available in admin area at all - does not show when looking at Customer in question.
Anyone come across this?

Big Decision
Website Production, Ecommerce & Digital Marketing in the UK
http://www.bigdecision.co.uk


New member

Posts

Joined
Sat Nov 09, 2013 8:29 pm

Post by straightlight » Sat Apr 07, 2018 1:02 am


The most generated errors being found on Opencart forum originates from contributed programming.

Regards,
Straightlight


Legendary Member

Posts

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

Post by webs_bd » Tue Apr 10, 2018 11:15 pm

Sorry - to clarify, if I overwrote these 3 files it should clear the problem?
Would I need to create custom fields again or should this adjust and work for existing custom fields I already created?

Big Decision
Website Production, Ecommerce & Digital Marketing in the UK
http://www.bigdecision.co.uk


New member

Posts

Joined
Sat Nov 09, 2013 8:29 pm

Post by straightlight » Tue Apr 10, 2018 11:40 pm

Replacing these 3 files and clearing your OC cache from the OC admin should do it. There's no need to re-create the custom fields after replacing those files.

The most generated errors being found on Opencart forum originates from contributed programming.

Regards,
Straightlight


Legendary Member

Posts

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

Post by webs_bd » Wed Apr 11, 2018 12:34 am

Thanks. No luck unfortunately. The field shows in customer front end but will not save entered value. Field does not show at all in admin.

Big Decision
Website Production, Ecommerce & Digital Marketing in the UK
http://www.bigdecision.co.uk


New member

Posts

Joined
Sat Nov 09, 2013 8:29 pm

Post by straightlight » Wed Apr 11, 2018 12:35 am

From which admin page are you filling the custom field exactly? Have you also cleared your OC cache by applying these steps: viewtopic.php?f=176&p=718325#p718325 ?

The most generated errors being found on Opencart forum originates from contributed programming.

Regards,
Straightlight


Legendary Member

Posts

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

Post by webs_bd » Wed Apr 11, 2018 12:48 am

I have cleared caches yes.
I was trying to login as an existing customer then edit this field under 'edit account' to add a value for this new field

Big Decision
Website Production, Ecommerce & Digital Marketing in the UK
http://www.bigdecision.co.uk


New member

Posts

Joined
Sat Nov 09, 2013 8:29 pm

Post by straightlight » Wed Apr 11, 2018 12:55 am

Ensure that the registered customer account is within the same customer group where the custom field has been created from the OC admin. Both readings must match.

The most generated errors being found on Opencart forum originates from contributed programming.

Regards,
Straightlight


Legendary Member

Posts

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

Post by webs_bd » Wed Apr 11, 2018 1:30 am

Yes they already match - I just have one customer group (Default).
The field shows fine in the customer account area - it is just the fact that the entered value does not save

Big Decision
Website Production, Ecommerce & Digital Marketing in the UK
http://www.bigdecision.co.uk


New member

Posts

Joined
Sat Nov 09, 2013 8:29 pm

Post by straightlight » Wed Apr 11, 2018 3:34 am

Let's test this. In catalog/model/account/customer.php file,

find:

Code: Select all

$this->db->query("UPDATE " . DB_PREFIX . "customer SET firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', email = '" . $this->db->escape($data['email']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', custom_field = '" . $this->db->escape(isset($data['custom_field']['account']) ? json_encode($data['custom_field']['account']) : '') . "' WHERE customer_id = '" . (int)$customer_id . "'");
add below:

Code: Select all

if (!empty($this->session->data['user_token'])) {
    exit;
}
Then, as still being logged in as a customer from the OC admin customer link, go back to the edit account page. Once saving the form, you should see a blank background screen. This is intended. Do you see any messages on that screen once the form submitted?

The most generated errors being found on Opencart forum originates from contributed programming.

Regards,
Straightlight


Legendary Member

Posts

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

Post by webs_bd » Wed Apr 11, 2018 7:18 pm

Thank you for looking into this.
I do indeed get the blank screen. There is no message that shows however and nothing gets saved.

Can I just check something please - code below (have included a little above and below so you can see!). I just wanted to ensure I didn't have an extra bracket in there:

return $customer_id;
}

public function editCustomer($customer_id, $data) {
$this->db->query("UPDATE " . DB_PREFIX . "customer SET firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', email = '" . $this->db->escape($data['email']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', custom_field = '" . $this->db->escape(isset($data['custom_field']['account']) ? json_encode($data['custom_field']['account']) : '') . "' WHERE customer_id = '" . (int)$customer_id . "'");
if (!empty($this->session->data['user_token'])) {
exit;
}
}

public function editPassword($email, $password) {
$this->db->query("UPDATE " . DB_PREFIX . "customer SET salt = '" . $this->db->escape($salt = token(9)) . "', password = '" . $this->db->escape(sha1($salt . sha1($salt . sha1($password)))) . "', code = '' WHERE LOWER(email) = '" . $this->db->escape(utf8_strtolower($email)) . "'");
}

Big Decision
Website Production, Ecommerce & Digital Marketing in the UK
http://www.bigdecision.co.uk


New member

Posts

Joined
Sat Nov 09, 2013 8:29 pm

Post by straightlight » Wed Apr 11, 2018 7:34 pm

The added code location is valid. However, ensure the display errors on your domain are enabled. The blank screen you are getting may also mean you have a hidden error message. Check in your admin - > systems - > maintenance - > error logs page for the latest error message regarding the account/edit page.

The most generated errors being found on Opencart forum originates from contributed programming.

Regards,
Straightlight


Legendary Member

Posts

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

Post by webs_bd » Wed Apr 11, 2018 8:58 pm

Thanks - no errors showing I'm afraid.
The regex doesn't have anything to do with it does it? Nothing is specified here but wondered if it should maybe?

Big Decision
Website Production, Ecommerce & Digital Marketing in the UK
http://www.bigdecision.co.uk


New member

Posts

Joined
Sat Nov 09, 2013 8:29 pm

Post by straightlight » Wed Apr 11, 2018 9:23 pm

If you want to try the validate() method results, remove the above troubleshoot lines . Then, in your catalog/controller/account/edit.php file,

find:

Code: Select all

$this->session->data['success'] = $this->language->get('text_success');
add above:

Code: Select all

if (!empty($this->session->data['user_token'])) {
    exit;
}
Then, re-apply the same steps by re-logging as an admin and login as a customer from the admin. Then, go back to the edit form and re-save the form. The REGEX validation would still provide an error message if this was the related issue since, by default, the REGEX are already checked in the account edit page as well when the form is being saved.

The most generated errors being found on Opencart forum originates from contributed programming.

Regards,
Straightlight


Legendary Member

Posts

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

Post by webs_bd » Wed Apr 11, 2018 10:22 pm

Thanks again.
Unfortunately still no luck.
I tried creating a new customer as well with this field filled in but it just does not register.
I checked in phpmyadmin too and nothing showing (custom field is there but no values).

Big Decision
Website Production, Ecommerce & Digital Marketing in the UK
http://www.bigdecision.co.uk


New member

Posts

Joined
Sat Nov 09, 2013 8:29 pm

Post by straightlight » Thu Apr 12, 2018 12:13 am

Ensure your database credentials are all check marked from your host console.

The most generated errors being found on Opencart forum originates from contributed programming.

Regards,
Straightlight


Legendary Member

Posts

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

Post by webs_bd » Thu Apr 12, 2018 12:49 am

Sorry! Not sure what you mean......

Big Decision
Website Production, Ecommerce & Digital Marketing in the UK
http://www.bigdecision.co.uk


New member

Posts

Joined
Sat Nov 09, 2013 8:29 pm

Post by straightlight » Thu Apr 12, 2018 12:55 am

Then, the issue may lie there. Follow this Youtube video on how to database privileges: https://www.youtube.com/watch?v=9QhID5g2S2A

The most generated errors being found on Opencart forum originates from contributed programming.

Regards,
Straightlight


Legendary Member

Posts

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

Post by webs_bd » Thu Apr 12, 2018 3:32 am

Right sorry - no all database privileges are fine and as they should be.

Big Decision
Website Production, Ecommerce & Digital Marketing in the UK
http://www.bigdecision.co.uk


New member

Posts

Joined
Sat Nov 09, 2013 8:29 pm

Post by straightlight » Thu Apr 12, 2018 3:37 am

In your PHPMyAdmin, what is your COLLATE settings and also your database table types?

The most generated errors being found on Opencart forum originates from contributed programming.

Regards,
Straightlight


Legendary Member

Posts

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

Users browsing this forum: DigitCart and 17 guests