Post by SubatWest » Wed Jun 09, 2021 4:59 pm

Hi
Using Version 3.0.3.6 on default theme.
I am getting the following error message that appears twice for the same time slot:
2021-06-09 8:26:30 - PHP Notice: Undefined index: id in /home/*/public_html/admin/controller/extension/advertise/google.php on line 1691
2021-06-09 8:26:30 - PHP Notice: Undefined index: id in /home/*/public_html/admin/controller/extension/advertise/google.php on line 1691
The code involved is:

Code: Select all

foreach ($data['menus'] as &$menu) {
          [highlight]  if ($menu['id'] == 'menu-marketing') {[/highlight]
                $children = array();

                $this->load->model('setting/store');

                $children[] = array(
                    'name' => $this->config->get('config_name'),
                    'children' => array(),
                    'href' => $this->url->link('extension/advertise/google', 'store_id=0&user_token=' . $this->session->data['user_token'], true)
                );
The offending line is highlighted.
Have searched around for solution but drawn a blank.
Anyone have any idea what this is?
Help appreciated.

Active Member

Posts

Joined
Fri Oct 31, 2014 1:29 am

Post by straightlight » Wed Jun 09, 2021 6:27 pm

SubatWest wrote:
Wed Jun 09, 2021 4:59 pm
Hi
Using Version 3.0.3.6 on default theme.
I am getting the following error message that appears twice for the same time slot:
2021-06-09 8:26:30 - PHP Notice: Undefined index: id in /home/*/public_html/admin/controller/extension/advertise/google.php on line 1691
2021-06-09 8:26:30 - PHP Notice: Undefined index: id in /home/*/public_html/admin/controller/extension/advertise/google.php on line 1691
The code involved is:

Code: Select all

foreach ($data['menus'] as &$menu) {
          [highlight]  if ($menu['id'] == 'menu-marketing') {[/highlight]
                $children = array();

                $this->load->model('setting/store');

                $children[] = array(
                    'name' => $this->config->get('config_name'),
                    'children' => array(),
                    'href' => $this->url->link('extension/advertise/google', 'store_id=0&user_token=' . $this->session->data['user_token'], true)
                );
The offending line is highlighted.
Have searched around for solution but drawn a blank.
Anyone have any idea what this is?
Help appreciated.
Caused by an installed extension. The core does not use this field key in the original and delivered extension out-of-the-box. Contact the extension developer to resolve this issue. As an alternative, you could also create a new service request in the Commercial Support section of the forum to have this issue fixed as a custom job.

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 ADD Creative » Wed Jun 09, 2021 8:03 pm

You probably have a theme/modification that modifies the navigation menu in some way. Try disabling your theme/modifications one by one until you find the one causing the error.

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by SubatWest » Wed Jun 09, 2021 8:45 pm

Thanks guys that would lead me to an extension that was installed, causing the error. Will now follow this up.

Active Member

Posts

Joined
Fri Oct 31, 2014 1:29 am

Post by SubatWest » Sat Jun 12, 2021 4:11 am

Had a look at the core file in the downloaded zip and it has this code:

Code: Select all

public function admin_link(&$route, &$data, &$template) {
        if (!$this->user->hasPermission('access', 'extension/advertise/google')) {
            return;
        }

        foreach ($data['menus'] as &$menu) {
            if ($menu['id'] == 'menu-marketing') {
                $children = array();

                $this->load->model('setting/store');

                $children[] = array(
                    'name' => $this->config->get('config_name'),
                    'children' => array(),
                    'href' => $this->url->link('extension/advertise/google', 'store_id=0&user_token=' . $this->session->data['user_token'], true)
                );

                foreach ($this->model_setting_store->getStores() as $store) {
                    $children[] = array(
                        'name' => $store['name'],
                        'children' => array(),
                        'href' => $this->url->link('extension/advertise/google', 'store_id=' . $store['store_id'] . '&user_token=' . $this->session->data['user_token'], true)
                    );
                }

                array_push($menu['children'], array(
                    'name' => 'Google Shopping',
                    'children' => $children,
                    'href' => ''
                ));
                
                           return;
            }
        }
    }
I tried to fix it using:

Code: Select all

public function injectAdminMenuItem($eventRoute, &$data) {
        if ($this->user->hasPermission('access', $this->extension/advertise/google)) {
			return;
		}
to replace:

Code: Select all

public function admin_link(&$route, &$data, &$template) {
        if (!$this->user->hasPermission('access', 'extension/advertise/google')) {
            return;
        }
This has cuased the error to disappear and I am hoping its a p[ermanent fix.

Active Member

Posts

Joined
Fri Oct 31, 2014 1:29 am

Post by ADD Creative » Sat Jun 12, 2021 5:10 pm

Doesn't make any sense. Just a convoluted way of removing the admin_link function.

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by straightlight » Sat Jun 12, 2021 5:22 pm

SubatWest wrote:
Sat Jun 12, 2021 4:11 am
Had a look at the core file in the downloaded zip and it has this code:

Code: Select all

public function admin_link(&$route, &$data, &$template) {
        if (!$this->user->hasPermission('access', 'extension/advertise/google')) {
            return;
        }

        foreach ($data['menus'] as &$menu) {
            if ($menu['id'] == 'menu-marketing') {
                $children = array();

                $this->load->model('setting/store');

                $children[] = array(
                    'name' => $this->config->get('config_name'),
                    'children' => array(),
                    'href' => $this->url->link('extension/advertise/google', 'store_id=0&user_token=' . $this->session->data['user_token'], true)
                );

                foreach ($this->model_setting_store->getStores() as $store) {
                    $children[] = array(
                        'name' => $store['name'],
                        'children' => array(),
                        'href' => $this->url->link('extension/advertise/google', 'store_id=' . $store['store_id'] . '&user_token=' . $this->session->data['user_token'], true)
                    );
                }

                array_push($menu['children'], array(
                    'name' => 'Google Shopping',
                    'children' => $children,
                    'href' => ''
                ));
                
                           return;
            }
        }
    }
I tried to fix it using:

Code: Select all

public function injectAdminMenuItem($eventRoute, &$data) {
        if ($this->user->hasPermission('access', $this->extension/advertise/google)) {
			return;
		}
to replace:

Code: Select all

public function admin_link(&$route, &$data, &$template) {
        if (!$this->user->hasPermission('access', 'extension/advertise/google')) {
            return;
        }
This has cuased the error to disappear and I am hoping its a p[ermanent fix.
No core files contains this method. That's an extension.

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: jagall, SohBH and 259 guests