Post by trixiemay » Mon Jul 29, 2019 7:03 am

Trying to work out how to add large images for each category on the category > refine search page.
So replacing the unordered list with a clickable image through to the product list for that category.
Any suggestions please?

___________________________________________
"Speak softly but carry a big stick" :crazy:


New member

Posts

Joined
Thu Mar 09, 2017 2:53 pm


Post by ostechnologies » Mon Jul 29, 2019 3:47 pm

If we talk about the default theme then you need to make changes to two files
File : catalog->controller->product->category.php
Change : Need to add image URL item in $data['categories'] array.

File : catalog->view->theme->default->template->product->category.twig
Change : Need to include image tag in “ <li><a href="{{ category.href }}">{{ category.name }}</a></li> “ & “ <li><a href="{{ child.href }}">{{ child.name }}</a></li> ”

Opencart Expert | sales[at]ost.agency
Skype - manish.osuniverse | Gtalk - manishmt

Extensions for Opencart @ https://www.ost.agency/product/product- ... extensions
ost.agency - ecommerce website design, development and digital company


User avatar
Active Member

Posts

Joined
Mon Apr 06, 2015 1:30 pm

Post by trixiemay » Tue Jul 30, 2019 6:52 am

@ostechnologies
How is the code written for this?
I don't know the correct path for the images. They are in the File Manager in a folder called 'Catagories'

___________________________________________
"Speak softly but carry a big stick" :crazy:


New member

Posts

Joined
Thu Mar 09, 2017 2:53 pm


Post by trixiemay » Wed Jul 31, 2019 5:22 am

Tried this in category.php but get errors:

Code: Select all

//CATEGORIES WITH IMAGE
			if($result['image']) {
			$image = $this->model_tool_image->resize($result['image'], 200, 200);
			 } else {
			$image = $this->model_tool_image->resize('no_image.png', 200, 200);
			 }
				
			$data['categories'] = array();

			$results = $this->model_catalog_category->getCategories($category_id);

			foreach ($results as $result) {
				$filter_data = array(
					'filter_category_id'  => $result['category_id'],
					'filter_sub_category' => true
				);

				
				if ($result['image']) {
					$image = $this->model_tool_image->resize($result['image'], 100, 100);
				} else {
					$image = $this->model_tool_image->resize('placeholder.png', 100, 100);
				}
				
				$data['categories'][] = array(
					'name'  => $result['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''),
					'href'  => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url),
					'thumb' => $image
				);
			}

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

			$filter_data = array(
				'filter_category_id' => $category_id,
				'filter_filter'      => $filter,
				'sort'               => $sort,
				'order'              => $order,
				'start'              => ($page - 1) * $limit,
				'limit'              => $limit
			);
			

___________________________________________
"Speak softly but carry a big stick" :crazy:


New member

Posts

Joined
Thu Mar 09, 2017 2:53 pm


Post by ostechnologies » Mon Aug 05, 2019 2:36 pm

What was the error please mention.

Opencart Expert | sales[at]ost.agency
Skype - manish.osuniverse | Gtalk - manishmt

Extensions for Opencart @ https://www.ost.agency/product/product- ... extensions
ost.agency - ecommerce website design, development and digital company


User avatar
Active Member

Posts

Joined
Mon Apr 06, 2015 1:30 pm
Who is online

Users browsing this forum: thekrotek and 30 guests