Post by straightlight » Mon Mar 11, 2019 3:07 am

Followed is for all OC v3.x releases and will not only convert the page values to numeric but also replace the 0 value to 1 (default) despite where it's defined on the browser.

In your catalog/controller/startup/router.php and admin/controller/startup/router.php file,

find in both locations:

Code: Select all

// Route
		if (isset($this->request->get['route']) && $this->request->get['route'] != 'startup/router') {
			$route = $this->request->get['route'];
		} else {
			$route = $this->config->get('action_default');
		}
replace both statements in both files with:

Code: Select all

// Route
		if (isset($this->request->get['route']) && $this->request->get['route'] != 'startup/router') {
			if (isset($this->request->get['page']) && (int)$this->request->get['page'] < 1) {
				$this->request->get['page'] = 1;
			}
			
			$route = $this->request->get['route'];
		} else {
			$route = $this->config->get('action_default');
		}
This should resolved the issue.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by straightlight » Mon Mar 11, 2019 4:02 am

Code modified above. Removed site redirection so to enforce the numeric page value from 0 to 1 on the back-end instead even though the page=0 is still queried from URL as this tactic will rather return positive results to search engines that implicit the use of SEO URLs.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by mRC » Mon Mar 11, 2019 4:49 am

thanks for the fix

mRC
Active Member

Posts

Joined
Wed Nov 12, 2014 12:43 am

Post by straightlight » Mon Mar 11, 2019 6:05 am

No problem.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by mRC » Mon Mar 11, 2019 3:57 pm

Hi

Just noticed that in the original code \admin\controller\startup\router.php there is the following

Code: Select all

		$data = array();
Should the this be included in the \admin\controller\startup\router.php ?

for example

Code: Select all

// Route
		if (isset($this->request->get['route']) && $this->request->get['route'] != 'startup/router') {
			if (isset($this->request->get['page']) && (int)$this->request->get['page'] < 1) {
				$this->request->get['page'] = 1;
			}
			
			$route = $this->request->get['route'];
		} else {
			$route = $this->config->get('action_default');
		}
		
		$data = array();

mRC
Active Member

Posts

Joined
Wed Nov 12, 2014 12:43 am

Post by straightlight » Mon Mar 11, 2019 5:28 pm

You are pointing to the same folder and file twice above. However, I did noticed it between the admin and the catalog that the $data = array() is only used in the admin as this has been discussed on GitHub sometime ago about it. For now, I'd just leave it as is, since it does not seem to be problematic to the users when the $data array is being called from the controllers nor the events. Besides, there's a modified version on GitHub with article 7153 that already provides an alternative with events and lambda (GitHub version).

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by mRC » Tue Mar 12, 2019 2:00 am

Yes its only in the admin version, but that's fine.

Thanks for the reply I was just making sure.

mRC
Active Member

Posts

Joined
Wed Nov 12, 2014 12:43 am

Post by Nordikota » Fri Mar 22, 2019 3:18 pm

@Straightlight. I've modified the file as above. Checked the htaccess file and there are no re-directs, but I'm still getting this error. It appears on the top of invoices when I view an order to print - which is a bit of a problem. :o Any ideas?

Active Member

Posts

Joined
Tue Feb 11, 2014 8:04 pm

Post by straightlight » Fri Mar 22, 2019 7:08 pm


The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


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 8 guests