Post by joemaydew » Wed Sep 27, 2017 6:51 pm

I hope this is really simple. In the Admin of the store the header.tpl has the following php echo

Code: Select all

<?php echo $processing_status_total; ?>
However, if I add the same echo to the dashboard.tpl it comes up with an error saying undefined variable. Can anyone tell me what I am missing please?

User avatar
New member

Posts

Joined
Wed May 07, 2014 4:58 pm
Location - Staffordshire, United Kingdom

Post by thekrotek » Wed Sep 27, 2017 7:01 pm

Why are you trying to use echo() function, when you don't know, how to debug PHP errors? You error is very basic one: variable not defined.

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member
Online

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by joemaydew » Wed Sep 27, 2017 7:14 pm

I understand your point.
I am trying to learn and thought that the forum would be the best place for help.

User avatar
New member

Posts

Joined
Wed May 07, 2014 4:58 pm
Location - Staffordshire, United Kingdom

Post by thekrotek » Wed Sep 27, 2017 7:19 pm

OK, this is a good answer. In this case, you need to define 'processing_status_total' index in $data array somewhere in dashboard.php controller. Look, how this index is defined in header.php and do the same for dashboard. If you won't find it in header.php, search in files for this index - it should be somewhere.

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member
Online

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by joemaydew » Wed Sep 27, 2017 7:40 pm

Thanks! That's perfect.

I didn't realise that it needed define in both places. Makes sense now.

User avatar
New member

Posts

Joined
Wed May 07, 2014 4:58 pm
Location - Staffordshire, United Kingdom

Post by thekrotek » Wed Sep 27, 2017 7:49 pm

In short, every controller contains $data array, which is being extracted using PHP extract() function, when template is fetched. This is why every 'index' turns into $index - extract() function does that.

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member
Online

Posts

Joined
Sun Jul 03, 2016 12:24 am

Who is online

Users browsing this forum: No registered users and 29 guests