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 164 times

ps1.PNG

ps1.PNG (7.84 KiB) Viewed 164 times


Active Member

Posts

Joined
Sun Mar 24, 2019 6:08 pm

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.

For quick, professional OpenCart support please email info@antropy.co.uk


User avatar
Guru Member

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - Reigate, Surrey, 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

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 .

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.


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