Post by Geegee20 » Thu Jan 24, 2019 6:55 pm

I use the latest module supplied with open at 2.3.0.1. Is there a way to exclude some products from appearing in this module when you a a new product

New member

Posts

Joined
Tue Mar 14, 2017 7:16 pm

Post by kestas » Thu Jan 24, 2019 9:01 pm

yes it is.
you need edit this file: catalog/controller/extension/module/latest.php

find:

Code: Select all

 $data['products'][] = array(
					'product_id'  => $result['product_id'],
					'thumb'       => $image,
					'name'        => $result['name'],
					'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get($this->config->get('config_theme') . '_product_description_length')) . '..',
					'price'       => $price,
					'special'     => $special,
					'tax'         => $tax,
					'rating'      => $rating,
					'href'        => $this->url->link('product/product', 'product_id=' . $result['product_id'])
				);
 
replace with:

Code: Select all

 $restrict_products = array(1, 2, 3, 4, 5);
			
			if (!in_array($result['product_id'], $restrict_products)) {

				$data['products'][] = array(
					'product_id'  => $result['product_id'],
					'thumb'       => $image,
					'name'        => $result['name'],
					'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get($this->config->get('config_theme') . '_product_description_length')) . '..',
					'price'       => $price,
					'special'     => $special,
					'tax'         => $tax,
					'rating'      => $rating,
					'href'        => $this->url->link('product/product', 'product_id=' . $result['product_id'])
				);
			} 
(1, 2, 3, 4, 5) in array... are your products id's which should be excluded from the latest. You can add there id's of your products which you want exclude from latest list.

Cheers

Custom OpenCart modules and solutions. You can write PM with additional questions... Extensions you can find here


Active Member

Posts

Joined
Tue Oct 12, 2010 2:23 am

Post by Geegee20 » Fri Jan 25, 2019 5:49 pm

Thank you for your reply.

This would mean when you add new products and you want to exclude you have to adjust this file each time?

Is there a way to have a check box on the product to allow for this exclusion?

New member

Posts

Joined
Tue Mar 14, 2017 7:16 pm

Post by kestas » Fri Jan 25, 2019 6:30 pm

Please check your PM.

Custom OpenCart modules and solutions. You can write PM with additional questions... Extensions you can find here


Active Member

Posts

Joined
Tue Oct 12, 2010 2:23 am
Who is online

Users browsing this forum: No registered users and 7 guests