Post by bhraqnet » Sat Mar 12, 2016 5:34 pm

When you open the Customers page shows me this error
opencart 2.2.0.0


See the photos attached
A new version does not contain any extensions

What is the solution to this problem

Attachments

photo5.jpg

photo5.jpg (353.48 KiB) Viewed 8384 times


Active Member

Posts

Joined
Thu Dec 26, 2013 11:16 pm

Post by aaron1988 » Sun Mar 13, 2016 9:11 am

Hey,

Edit the file: admin/controller/customer/customer.php

find:

Code: Select all

foreach ($custom_fields as $custom_field) {
					if (($custom_field['location'] == 'address') && $custom_field['required'] && empty($value['custom_field'][$custom_field['custom_field_id']])) {
						$this->error['address'][$key]['custom_field'][$custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field'), $custom_field['name']);
					} elseif (($custom_field['type'] == 'text' && !empty($custom_field['validation'] && $custom_field['location'] == 'address')) && !filter_var($value['custom_field'][$custom_field['custom_field_id']], FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $custom_field['validation'])))) {
                        $this->error['address'][$key]['custom_field'][$custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field_validate'), $custom_field['name']);
                    }
and replace with:

Code: Select all

foreach ($custom_fields as $custom_field) {
					if (($custom_field['location'] == 'address') && $custom_field['required'] && empty($value['custom_field'][$custom_field['custom_field_id']])) {
						$this->error['address'][$key]['custom_field'][$custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field'), $custom_field['name']);
					} elseif (($custom_field['type'] == 'text' && !empty($custom_field['validation']) &&  $custom_field['location'] == 'address') && !filter_var($value['custom_field'][$custom_field['custom_field_id']], FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $custom_field['validation'])))) {
                        $this->error['address'][$key]['custom_field'][$custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field_validate'), $custom_field['name']);
                    }
the code i changed is this: custom_field['validation'] had in correctly had a ) so i removed it and moved it to the end of that statement.

Thanks
Aaron

Active Member

Posts

Joined
Thu Jan 27, 2011 10:03 am

Post by Randem » Sun Mar 13, 2016 9:26 am

Yes, v2.2.0.0 is not ready yet... - http://forum.opencart.com/viewtopic.php?f=181&t=158954

NEVER take serious; anyone who gives negative impact statements with no ABSOLUTE proof!
OpenCart Helpful Information * Upgrade 1.5 to 2.1 * Upgrade 2.1 to 2.2
"Why do people NEVER have enough time to do it right but ALWAYS enough time to do it over?"
DO NOT EVER GIVE SOMEONE YOU DON"T KNOW ADMIN ACCESS TO ANYTHING!
I am NOT affiliated with OpenCart


User avatar
Active Member

Posts

Joined
Sat Sep 27, 2014 9:17 am

Post by bhraqnet » Sun Mar 13, 2016 1:22 pm

Mr aaron1988
The problem was the solution
thank you

Active Member

Posts

Joined
Thu Dec 26, 2013 11:16 pm

Post by teofilpop » Fri Mar 25, 2016 4:10 am

I try this 2.2.0.0 version.
First i try on local host with windows 10 and apache. everything it's ok and i don' receive any error. At least on the side with customer.
Second I installed on the online server with linux and ajenti. And here i have same error like in the post. And even another error in the frontside in myaccount/address. If I am a client, i can't manage adress book. Error is something like page don't working error 500. All other links in myaccount it seems to work corectly except adress book.

So for the first error i'll make the changes that was sugested here and now i can manage customers in admin/customers. With an observation that i try with "address" and "account" and it seems to works corectly with both. I try with ($custom_field['location'] == 'address') because in this post appear with address but in the kit installer that i downloaded from opencart and install it was "account" insteas "adress".

Anyway until now the first problem it looks like is resolved.
Please anybody can give me an ideea for the second problem from frontend ? Or maybe I must do some special settings on my server ?

I must say that with previous version of OC 2.1 or smaller i don't face with this error and i don't change any setting on the server from then.

Newbie

Posts

Joined
Wed Feb 26, 2014 1:59 am

Post by Randem » Fri Mar 25, 2016 4:20 am

Hi teofilpop,

Fix: Fix Customer.php file Syntax Error - aaron1988 - v1.0.0
Fix: Fix Address.php file Syntax Error - v1.0.0

The can be found here - http://www.randemsystems.com/support/op ... t-only%29/

NEVER take serious; anyone who gives negative impact statements with no ABSOLUTE proof!
OpenCart Helpful Information * Upgrade 1.5 to 2.1 * Upgrade 2.1 to 2.2
"Why do people NEVER have enough time to do it right but ALWAYS enough time to do it over?"
DO NOT EVER GIVE SOMEONE YOU DON"T KNOW ADMIN ACCESS TO ANYTHING!
I am NOT affiliated with OpenCart


User avatar
Active Member

Posts

Joined
Sat Sep 27, 2014 9:17 am

Post by teofilpop » Fri Mar 25, 2016 5:06 am

thank you Randem.
Meanwhile i found this links
https://github.com/waqasjawed/opencart/ ... 14c4a6b1b0
https://github.com/waqasjawed/opencart/ ... 1fff2db0c6
who solved my problems.

Newbie

Posts

Joined
Wed Feb 26, 2014 1:59 am

Post by Randem » Fri Mar 25, 2016 5:51 am

Yes, the same answers. Are you changing the files yourself or using VQMOD or OCMOD?

Code Changing

NEVER take serious; anyone who gives negative impact statements with no ABSOLUTE proof!
OpenCart Helpful Information * Upgrade 1.5 to 2.1 * Upgrade 2.1 to 2.2
"Why do people NEVER have enough time to do it right but ALWAYS enough time to do it over?"
DO NOT EVER GIVE SOMEONE YOU DON"T KNOW ADMIN ACCESS TO ANYTHING!
I am NOT affiliated with OpenCart


User avatar
Active Member

Posts

Joined
Sat Sep 27, 2014 9:17 am

Post by wbizs » Thu Apr 14, 2016 8:36 am

aaron1988 wrote:Hey,

Edit the file: admin/controller/customer/customer.php

find:

Code: Select all

foreach ($custom_fields as $custom_field) {
					if (($custom_field['location'] == 'address') && $custom_field['required'] && empty($value['custom_field'][$custom_field['custom_field_id']])) {
						$this->error['address'][$key]['custom_field'][$custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field'), $custom_field['name']);
					} elseif (($custom_field['type'] == 'text' && !empty($custom_field['validation'] && $custom_field['location'] == 'address')) && !filter_var($value['custom_field'][$custom_field['custom_field_id']], FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $custom_field['validation'])))) {
                        $this->error['address'][$key]['custom_field'][$custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field_validate'), $custom_field['name']);
                    }
and replace with:

Code: Select all

foreach ($custom_fields as $custom_field) {
					if (($custom_field['location'] == 'address') && $custom_field['required'] && empty($value['custom_field'][$custom_field['custom_field_id']])) {
						$this->error['address'][$key]['custom_field'][$custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field'), $custom_field['name']);
					} elseif (($custom_field['type'] == 'text' && !empty($custom_field['validation']) &&  $custom_field['location'] == 'address') && !filter_var($value['custom_field'][$custom_field['custom_field_id']], FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $custom_field['validation'])))) {
                        $this->error['address'][$key]['custom_field'][$custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field_validate'), $custom_field['name']);
                    }
the code i changed is this: custom_field['validation'] had in correctly had a ) so i removed it and moved it to the end of that statement.

Thanks
Aaron
Many thanks, got same issue, fixed by your method

Newbie

Posts

Joined
Thu Apr 14, 2016 8:26 am

Post by StitchnBe » Mon Sep 12, 2016 2:48 am

Hi...I am having a similar problem. My customers can log to their account by they cannot modify their address book entries. They are getting the error below. I get the same error when I (as admin) try go in their account and attempt to change it. I can change it in the admin dashboard under customers without problem.

PARSE Error: syntax error, unexpected '&&'(T_BOOLEAN_AND), expecting ')' in /home/myname/public_html/catalogue/controller/account/address.php on line 522.


I am using 2.2.0.0 my code is not the same as that shown--i.e. - there is more different (probably wrong) than just the extra )

I have two areas of code which may have problems. Can you help me identify what needs to be taken out/put in. Be gentle I am not a programmer and am worried I may delete something I really need.

Code: Select all

foreach ($custom_fields as $custom_field) {
			if (($custom_field['location'] == 'account') && $custom_field['required'] && empty($this->request->post['custom_field'][$custom_field['custom_field_id']])) {
				$this->error['custom_field'][$custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field'), $custom_field['name']);
			} elseif (($custom_field['type'] == 'text' && !empty($custom_field['validation']) && $custom_field['location'] == 'account') && !filter_var($this->request->post['custom_field'][$custom_field['custom_field_id']], FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $custom_field['validation'])))) {
		        	$this->error['custom_field'][$custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field_validate'), $custom_field['name']);
		        }
This is the other area:

Code: Select all

[$custom_field['custom_field_id']])) {
						$this->error['address'][$key]['custom_field'][$custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field'), $custom_field['name']);
					} elseif (($custom_field['type'] == 'text' && !empty($custom_field['validation']) && $custom_field['location'] == 'address') && !filter_var($value['custom_field'][$custom_field['custom_field_id']], FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $custom_field['validation'])))) {
                        $this->error['address'][$key]['custom_field'][$custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field_validate'), $custom_field['name']);
                    }

New member

Posts

Joined
Sat May 17, 2014 3:48 am

Post by Randem » Mon Sep 12, 2016 3:01 am

Hi StitchnBe,

Then don't delete anything. That is why I created the VQMOD for this... ???

NEVER take serious; anyone who gives negative impact statements with no ABSOLUTE proof!
OpenCart Helpful Information * Upgrade 1.5 to 2.1 * Upgrade 2.1 to 2.2
"Why do people NEVER have enough time to do it right but ALWAYS enough time to do it over?"
DO NOT EVER GIVE SOMEONE YOU DON"T KNOW ADMIN ACCESS TO ANYTHING!
I am NOT affiliated with OpenCart


User avatar
Active Member

Posts

Joined
Sat Sep 27, 2014 9:17 am

Post by StitchnBe » Thu Sep 15, 2016 9:24 am

I need VQmod for dummies instructions. Am not a developer and not much experience with coding. :crazy:

New member

Posts

Joined
Sat May 17, 2014 3:48 am

Post by Randem » Thu Sep 15, 2016 9:39 am


NEVER take serious; anyone who gives negative impact statements with no ABSOLUTE proof!
OpenCart Helpful Information * Upgrade 1.5 to 2.1 * Upgrade 2.1 to 2.2
"Why do people NEVER have enough time to do it right but ALWAYS enough time to do it over?"
DO NOT EVER GIVE SOMEONE YOU DON"T KNOW ADMIN ACCESS TO ANYTHING!
I am NOT affiliated with OpenCart


User avatar
Active Member

Posts

Joined
Sat Sep 27, 2014 9:17 am
Who is online

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