Post by prototype0104 » Fri Apr 09, 2021 3:47 am

Hi guys! I have a problem with a little mod.
I m using OC 3.0.3.2
The mod is for show all categories of the product on the product page.
The code is like this:
Twig

Code: Select all

{% if categories  %}
			{{ text_linked_categories }} <BR><BR>
			<div class="catlist">
				{% for category in categories %}
			
				<a href="{{ category.href }}">{{ category.name }}</a> <BR>
				
			{% endfor %}
			</div>
Controller

Code: Select all

$querycats = $this->model_catalog_product->getCategories($product_id);
				$categories = array();
				
				foreach( $querycats as $item ) {
					$categ = $this->model_catalog_category->getCategory($item['category_id']);
					if ($categ['parent_id'] > 0) {
						$catinfo['href'] = $this->url->link('product/category', 'path=' . $categ['parent_id'] . '_' . $item['category_id']);
						$parentname = $this->model_catalog_category->getCategory($categ['parent_id']);
						$categ1['name'] = $parentname['name'];
					}
					else {					
						$catinfo['href'] = $this->url->link('product/category', 'path=' . $item['category_id']);
					}
					$catinfo['name'] = $categ1['name']." >>> ".$categ['name'];
					$categories[] = $catinfo;
				}
All good if I'm accesing the product from category product list. ( check ps1.png ).
The problem is when I access the product from search page. ( check ps2.png ).
So accessing from search page will result hidden content and I don't not why. If variable will be null at least " >>> " whould appear...
Anyone has any idea?
Thank you!

Attachments

ps2.PNG

ps2.PNG (10.75 KiB) Viewed 245 times

ps1.PNG

ps1.PNG (7.84 KiB) Viewed 245 times

Last edited by prototype0104 on Thu Aug 19, 2021 4:33 pm, edited 1 time in total.

Active Member

Posts

Joined
Sun Mar 24, 2019 6:08 pm
Location - Romania

Post by paulfeakins » Fri Apr 09, 2021 6:22 pm

prototype0104 wrote:
Fri Apr 09, 2021 3:47 am
I have a problem with a little mod.
Contact the mod developer.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by prototype0104 » Fri Apr 09, 2021 8:20 pm

You are responding only for increase your post number?

Active Member

Posts

Joined
Sun Mar 24, 2019 6:08 pm
Location - Romania

Post by straightlight » Fri Apr 09, 2021 9:49 pm

prototype0104 wrote:
Fri Apr 09, 2021 8:20 pm
You are responding only for increase your post number?
You, indeed, need to contact the extension developer to resolve this issue. As an alternative, you could use this extension: https://www.opencart.com/index.php?rout ... n_id=14980 .

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: integraa and 265 guests