Post by RicardoMoutinho » Thu Sep 06, 2018 3:29 am

Hello my friends,

Im using 3.0.2 and i have an issue : Warning: vsprintf(): Too few arguments in /var/www/........../admin/controller/extension/dashboard/activity.php on line 98

Line 98 :

Code: Select all

	$comment = vsprintf($this->language->get('text_activity_' . $result['key']), json_decode($result['data'], true));
I believe this comes from the affiliated, but....wtf???

Can anyone help, please?

Active Member

Posts

Joined
Sat Aug 04, 2018 4:36 am

Post by straightlight » Thu Sep 06, 2018 4:22 am

Hum … a clue … I don't think this issue has ever been reported before (or may be I missed it). :ponder:

In admin/controller/extension/dashboard/activity.php file,

find:

Code: Select all

foreach ($results as $result) {
			$comment = vsprintf($this->language->get('text_activity_' . $result['key']), json_decode($result['data'], true));

			$find = array(
				'customer_id=',
				'order_id=',
				'return_id='
			);

			$replace = array(
				$this->url->link('customer/customer/edit', 'user_token=' . $this->session->data['user_token'] . '&customer_id='),
				$this->url->link('sale/order/info', 'user_token=' . $this->session->data['user_token'] . '&order_id='),
				$this->url->link('sale/return/edit', 'user_token=' . $this->session->data['user_token'] . '&return_id=')
			);

			$data['activities'][] = array(
				'comment'    => str_replace($find, $replace, $comment),
				'date_added' => date($this->language->get('datetime_format'), strtotime($result['date_added']))
			);
		}
replace with:

Code: Select all

foreach ($results as $result) {
if (isset($result['key']) && !empty($result['data'])) {
			$comment = vsprintf($this->language->get('text_activity_' . $result['key']), json_decode($result['data'], true));

			$find = array(
				'customer_id=',
				'order_id=',
				'return_id='
			);

			$replace = array(
				$this->url->link('customer/customer/edit', 'user_token=' . $this->session->data['user_token'] . '&customer_id='),
				$this->url->link('sale/order/info', 'user_token=' . $this->session->data['user_token'] . '&order_id='),
				$this->url->link('sale/return/edit', 'user_token=' . $this->session->data['user_token'] . '&return_id=')
			);

			$data['activities'][] = array(
				'comment'    => str_replace($find, $replace, $comment),
				'date_added' => date($this->language->get('datetime_format'), strtotime($result['date_added']))
			);
		}
	}
Then, apply these steps: viewtopic.php?f=176&p=733002#p718325 . See if the activities on the dashboard properly displays afterwards.

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 RicardoMoutinho » Thu Sep 06, 2018 4:42 am

Hey straightlight, thx for the reply,

I never saw this one, searched entire google...nothing, lol

Im guessing im one of a kind...hahahaha

Anyway...nothing...just throwed me with line 99 now...

I dont get it....

It should come from where? affiliated?

Active Member

Posts

Joined
Sat Aug 04, 2018 4:36 am

Post by straightlight » Thu Sep 06, 2018 4:46 am

Revert the changes. Then, on the same file and location, find:

Code: Select all

foreach ($results as $result) {
add below:

Code: Select all

$this->log->write('ACTIVITY DEBUG :: ' . json_decode($result));
Re-apply the cache steps afterwards. Then, visit your dashboard page and visit your admin - > systems - > maintenance - > error logs page. See if you notice something in the logs that begins with: ACTIVITY DEBUG :: .

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 RicardoMoutinho » Thu Sep 06, 2018 4:55 am

Error on top Dasboard :

Code: Select all

Warning: json_decode() expects parameter 1 to be string, array given in /var/www/vhosts/39/214720/webspace/httpdocs/foom/admin/controller/extension/dashboard/activity.php on line 98Warning: json_decode() expects parameter 1 to be string, array given in /var/www/vhosts/39/214720/webspace/httpdocs/fo.com/admin/controller/extension/dashboard/activity.php on line 98Warning: json_decode() expects parameter 1 to be string, array given in /var/www/vhosts/39/214720/webspace/httpdocs/foom/admin/controller/extension/dashboard/activity.php on line 98Warning: json_decode() expects parameter 1 to be string, array given in /var/www/vhosts/39/214720/webspace/httpdocs/forcom/admin/controller/extension/dashboard/activity.php on line 98Warning: vsprintf(): Too few arguments in /var/www/vhosts/39/214720/webspace/httpdocs/form/admin/controller/extension/dashboard/activity.php on line 99Warning: json_decode() expects parameter 1 to be string, array given in /var/www/vhosts/39/214720/webspace/httpdocs/forgm/admin/controller/extension/dashboard/activity.php on line 98
Error log :

Code: Select all

2018-09-05 20:53:15 - PHP Warning:  json_decode() expects parameter 1 to be string, array given in /var/www/vhosts/39/214720/webspace/httpdocs/forgm/admin/controller/extension/dashboard/activity.php on line 98
2018-09-05 20:53:15 - ACTIVITY DEBUG :: 
2018-09-05 20:53:15 - PHP Warning:  json_decode() expects parameter 1 to be string, array given in /var/www/vhosts/39/214720/webspace/httpdocs/form/admin/controller/extension/dashboard/activity.php on line 98
2018-09-05 20:53:15 - ACTIVITY DEBUG :: 
2018-09-05 20:53:15 - PHP Warning:  json_decode() expects parameter 1 to be string, array given in /var/www/vhosts/39/214720/webspace/httpdocs/forom/admin/controller/extension/dashboard/activity.php on line 98
2018-09-05 20:53:15 - ACTIVITY DEBUG :: 
2018-09-05 20:53:15 - PHP Warning:  json_decode() expects parameter 1 to be string, array given in /var/www/vhosts/39/214720/webspace/httpdocs/forgom/admin/controller/extension/dashboard/activity.php on line 98
2018-09-05 20:53:15 - ACTIVITY DEBUG :: 
2018-09-05 20:53:15 - PHP Warning:  vsprintf(): Too few arguments in /var/www/vhosts/39/214720/webspace/httpdocs/for.com/admin/controller/extension/dashboard/activity.php on line 99
2018-09-05 20:53:15 - PHP Warning:  json_decode() expects parameter 1 to be string, array given in /var/www/vhosts/39/214720/webspace/httpdocs/fm/admin/controller/extension/dashboard/activity.php on line 98
2018-09-05 20:53:15 - ACTIVITY DEBUG :: 
Last edited by RicardoMoutinho on Thu Sep 06, 2018 8:08 pm, edited 2 times in total.

Active Member

Posts

Joined
Sat Aug 04, 2018 4:36 am

Post by RicardoMoutinho » Thu Sep 06, 2018 5:08 am

i dont know if this helps....BUT...

Line 98 has : "text_activity_" when i change it to "text_activity" the error is gone.... Recent Activity will display "text_whatever" logged in, or "text_whetever_signupup"........

Active Member

Posts

Joined
Sat Aug 04, 2018 4:36 am

Post by straightlight » Thu Sep 06, 2018 5:16 am

In your PHPMyAdmin, on your Opencart database, do you see the customer_activity table?

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 RicardoMoutinho » Thu Sep 06, 2018 5:20 am

oc_customer_activity

Active Member

Posts

Joined
Sat Aug 04, 2018 4:36 am

Post by RicardoMoutinho » Thu Sep 06, 2018 5:24 am

Affiliate_add looks weird....idk

Image

Active Member

Posts

Joined
Sat Aug 04, 2018 4:36 am

Post by straightlight » Thu Sep 06, 2018 5:28 am

The affiliate_add's screenshot looks normal. Stored JSON encoded strings into that table which is what it would normally do (or almost normal since it's not in the database's best practices from the Industry anyways). Do you notice similar error messages from other pages in the admin?

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 RicardoMoutinho » Thu Sep 06, 2018 5:32 am

Nope, all is 100% correct Straighlight.

What i did now...

Line 98 : edited "text_activity_" to "text_activity"

No error, no error log, nothing...all peace and quiet....EXCEPT...

Image

Active Member

Posts

Joined
Sat Aug 04, 2018 4:36 am

Post by straightlight » Thu Sep 06, 2018 5:38 am

In your admin - > extensions - > events page, how many events do you see listed? Are they also all active?

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 RicardoMoutinho » Thu Sep 06, 2018 5:41 am

33 events....all enabled

Active Member

Posts

Joined
Sat Aug 04, 2018 4:36 am

Post by RicardoMoutinho » Thu Sep 06, 2018 5:45 am

changed again "text_activity" to "text_activity_"

Shows error on top, but Recent activity now, shows :

Image

Active Member

Posts

Joined
Sat Aug 04, 2018 4:36 am

Post by straightlight » Thu Sep 06, 2018 5:54 am

See if by replacing:

Code: Select all

$comment = vsprintf($this->language->get('text_activity_' . $result['key']), json_decode($result['data'], true));
with:

Code: Select all

$comment = vsprintf($this->language->get('text_activity_' . {$result['key']}), json_decode($result['data'], true));
would resolved the issue.

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 RicardoMoutinho » Thu Sep 06, 2018 5:59 am

just throws a blanck screen....only on dashboard

Active Member

Posts

Joined
Sat Aug 04, 2018 4:36 am

Post by straightlight » Thu Sep 06, 2018 6:10 am

What does it indicate in the error logs?

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 RicardoMoutinho » Thu Sep 06, 2018 2:13 pm

Ok, i think we are getting somewhere...

The error on dashboard : Warning: vsprintf(): Too few arguments in /var/www/vhosts/39/214720/webspace/httpdocs/forgd.com/admin/controller/extension/dashboard/activity.php on line 98

Error log the same as above.

I go to Affiliated and create account, error gone. Clean dashboard, recent activity working as expected.

I go to user and delete account...error comes back.

The bug is in affiliated php somewhere...
Last edited by RicardoMoutinho on Thu Sep 06, 2018 5:45 pm, edited 1 time in total.

Active Member

Posts

Joined
Sat Aug 04, 2018 4:36 am

Post by RicardoMoutinho » Thu Sep 06, 2018 2:23 pm

Right now...i went to create a new account. Error gone, etc...

From that account, i went to create an Affiliated account, i get this error :

Code: Select all

Notice: Undefined index: firstname in /var/www/vhosts/39/214720/webspace/httpdocs/forged.com/catalog/controller/event/activity.php on line 111Notice: Undefined index: lastname in /var/www/vhosts/39/214720/webspace/httpdocs/forgedg.com/catalog/controller/event/activity.php on line 111Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/39/214720/webspace/httpdocs/forgund.com/catalog/controller/startup/error.php:34) in /var/www/vhosts/39/214720/webspace/httpdocs/forund.com/system/library/response.php on line 36

Active Member

Posts

Joined
Sat Aug 04, 2018 4:36 am

Post by straightlight » Thu Sep 06, 2018 7:36 pm

Now, we're getting somewhere. See this post: viewtopic.php?f=2&t=205940#p730073 and download the alpha version by installing it on a separate folder with new database. Do NOT use it as a live store. Rather, for now, reproduce the exact event you just did with the affiliates on v3.0.2.0 release and see if the same issue can be reproduced.

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
Who is online

Users browsing this forum: No registered users and 244 guests