Post by supak111 » Sat May 11, 2024 3:06 am

Can someone tell me what needs to be changed in the code below to change product review view limit from 5 to 20?

There are 9 instances of number "5" in the code below, do I change all of them to number 20?

Code: Select all

	public function review() {
		$this->load->language('product/product');

		$this->load->model('catalog/review');

		if (isset($this->request->get['page'])) {
			$page = (int)$this->request->get['page'];
		} else {
			$page = 1;
		}

		$data['reviews'] = array();

		$review_total = $this->model_catalog_review->getTotalReviewsByProductId($this->request->get['product_id']);

		$results = $this->model_catalog_review->getReviewsByProductId($this->request->get['product_id'], ($page - 1) * 5, 5);

		foreach ($results as $result) {
			$data['reviews'][] = array(
				'author'     => $result['author'],
				'text'       => nl2br($result['text']),
				'rating'     => (int)$result['rating'],
				'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added']))
			);
		}

		$pagination = new Pagination();
		$pagination->total = $review_total;
		$pagination->page = $page;
		$pagination->limit = 5;
		$pagination->url = $this->url->link('product/product/review', 'product_id=' . $this->request->get['product_id'] . '&page={page}');

		$data['pagination'] = $pagination->render();

		$data['results'] = sprintf($this->language->get('text_pagination'), ($review_total) ? (($page - 1) * 5) + 1 : 0, ((($page - 1) * 5) > ($review_total - 5)) ? $review_total : ((($page - 1) * 5) + 5), $review_total, ceil($review_total / 5));

		$this->response->setOutput($this->load->view('product/review', $data));
	}
Last edited by supak111 on Sat May 11, 2024 6:12 pm, edited 1 time in total.

~ OC 3.0.3.2 and OCmods only ~


User avatar
Active Member

Posts

Joined
Fri Feb 13, 2015 12:09 pm

Post by OSWorX » Sat May 11, 2024 5:08 pm

supak111 wrote:
Sat May 11, 2024 3:06 am
Can someone tell me what needs to be changed in the code below to change product review view limit from 5 to 20?

There are 9 instances of number "5" in the code below, do I change all of them to number 20?
Yes.

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Administrator

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by supak111 » Sat May 11, 2024 6:12 pm

Thanks, it seems to work correctly changing all 9 number 5's to 20

~ OC 3.0.3.2 and OCmods only ~


User avatar
Active Member

Posts

Joined
Fri Feb 13, 2015 12:09 pm

Post by straightlight » Sat May 11, 2024 8:11 pm

OC v4.1.0.0 release now has defined variables for these limits of 5.

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 OSWorX » Sun May 12, 2024 3:49 pm

straightlight wrote:
Sat May 11, 2024 8:11 pm
OC v4.1.0.0 release now has defined variables for these limits of 5.
OC 4.1.0.0 is still NOT published nor ready for production!
Correct is, that this version has a new setting for that.

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Administrator

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by supak111 » Sun May 12, 2024 9:39 pm

Updating to the newest OC is a total pain when you have 20+ extensions, it's a million times easier to just do what I did above.

~ OC 3.0.3.2 and OCmods only ~


User avatar
Active Member

Posts

Joined
Fri Feb 13, 2015 12:09 pm

Post by straightlight » Mon May 13, 2024 12:58 am

OSWorX wrote:
Sun May 12, 2024 3:49 pm
straightlight wrote:
Sat May 11, 2024 8:11 pm
OC v4.1.0.0 release now has defined variables for these limits of 5.
OC 4.1.0.0 is still NOT published nor ready for production!
Correct is, that this version has a new setting for that.
It was not mentioned that it was nor have I suggested the opposite until the release being officially ready.

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