Page 1 of 1

A problem when you open a customer opencart2.2.0.0

Posted: Sat Mar 12, 2016 5:34 pm
by bhraqnet
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

Re: A problem when you open a customer opencart2.2.0.0

Posted: Sun Mar 13, 2016 9:11 am
by aaron1988
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

Re: A problem when you open a customer opencart2.2.0.0

Posted: Sun Mar 13, 2016 9:26 am
by Randem
Yes, v2.2.0.0 is not ready yet... - http://forum.opencart.com/viewtopic.php?f=181&t=158954

Re: A problem when you open a customer opencart2.2.0.0

Posted: Sun Mar 13, 2016 1:22 pm
by bhraqnet
Mr aaron1988
The problem was the solution
thank you

Re: A problem when you open a customer opencart2.2.0.0

Posted: Fri Mar 25, 2016 4:10 am
by teofilpop
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.

Re: A problem when you open a customer opencart2.2.0.0

Posted: Fri Mar 25, 2016 4:20 am
by Randem
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/

Re: A problem when you open a customer opencart2.2.0.0

Posted: Fri Mar 25, 2016 5:06 am
by teofilpop
thank you Randem.
Meanwhile i found this links
https://github.com/waqasjawed/opencart/ ... 14c4a6b1b0
https://github.com/waqasjawed/opencart/ ... 1fff2db0c6
who solved my problems.

Re: A problem when you open a customer opencart2.2.0.0

Posted: Fri Mar 25, 2016 5:51 am
by Randem
Yes, the same answers. Are you changing the files yourself or using VQMOD or OCMOD?

Code Changing

Re: A problem when you open a customer opencart2.2.0.0

Posted: Thu Apr 14, 2016 8:36 am
by wbizs
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

Re: A problem when you open a customer opencart2.2.0.0

Posted: Mon Sep 12, 2016 2:48 am
by StitchnBe
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']);
                    }

Re: A problem when you open a customer opencart2.2.0.0

Posted: Mon Sep 12, 2016 3:01 am
by Randem
Hi StitchnBe,

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

Re: A problem when you open a customer opencart2.2.0.0

Posted: Thu Sep 15, 2016 9:24 am
by StitchnBe
I need VQmod for dummies instructions. Am not a developer and not much experience with coding. :crazy:

Re: A problem when you open a customer opencart2.2.0.0

Posted: Thu Sep 15, 2016 9:39 am
by Randem