Page 1 of 1

Subcategory Thumbnail

Posted: 24 Mar 2016, 04:23
by Invictus
Hi,
How can I make my subcategories like my category page with thumbnails and view category button ?

Ty in advance
Dimitar

Re: Subcategory Thumbnail

Posted: 27 Mar 2016, 02:08
by Jan
Hi, sorry, I don't understand, subcategories have the same view like categories - the only one difference is that the back (up) button goes to parent category not to categories view :idea:

Jan

Re: Subcategory Thumbnail

Posted: 29 Mar 2016, 19:10
by Invictus
Hi , thank you for your response ,the problemis this - in my prime category view is good you can see in the picture

Image
http://imgur.com/0ZgcUcy

but when i go to subcategories ,it is like this

Image
http://imgur.com/so15gUw

all categories and subcaterogies are made the same , and all of them have image

Ty
Dimitar

Re: Subcategory Thumbnail

Posted: 31 Mar 2016, 20:21
by Jan
Hi, there is categories view - which display categories - when you go to category view, subcategories displayed here are not displayed in the category view like categories in categories view. This needs to be customized :idea:

Jan

Re: Subcategory Thumbnail

Posted: 21 Feb 2018, 16:13
by wildbiker
Hi!

I have same problem, how can i customize?

Thanks!

Re: Subcategory Thumbnail

Posted: 10 Mar 2018, 16:28
by sergiotimoff
Hi. I have the same problem. How can I customize? Thank you

Re: Subcategory Thumbnail

Posted: 13 Mar 2018, 13:13
by Jan
Hi, you can edit the output or override the Phoca Cart component output with your template:

components\com_phocacart\views\category\tmpl\default_header.php

This part displays the subcategories:

Code: Select all

if (!empty($this->subcategories) && (int)$this->t['cv_display_subcategories'] > 0) {
	echo '<div class="ph-subcategories">'.JText::_('COM_PHOCACART_SUBCATEGORIES') . ':</div>';
	echo '<ul>';
	$j = 0;
	foreach($this->subcategories as $v) {
		if ($j == (int)$this->t['cv_display_subcategories']) {
			break;
		}
		echo '<li><a href="'.JRoute::_(PhocacartRoute::getCategoryRoute($v->id, $v->alias)).'">'.$v->title.'</a></li>';
		$j++;
	}
	echo '</ul>';
	echo '<hr />';
}
If you want to display images there, the model must be customized (I will add this change to next version, so this will be no needed in future)


components\com_phocacart\models\category.php - line cca 238
FROM:

Code: Select all

$columns	= 'c.id, c.parent_id, c.title, c.alias, COUNT(c.id) AS numdoc';
			$groupsFull	= 'c.id, c.parent_id, c.title, c.alias';
TO:

Code: Select all

$columns	= 'c.id, c.parent_id, c.title, c.alias, c.image, COUNT(c.id) AS numdoc';
			$groupsFull	= 'c.id, c.parent_id, c.title, c.alias, c.image';

Example - the following code is a modification of above code to display image inside a tag (link to subcategory):

Code: Select all

if (!empty($this->subcategories) && (int)$this->t['cv_display_subcategories'] > 0) {
	echo '<div class="ph-subcategories">'.JText::_('COM_PHOCACART_SUBCATEGORIES') . ':</div>';
	echo '<ul>';
	$j = 0;
	foreach($this->subcategories as $v) {
		
	
		$image = PhocacartImage::getThumbnailName($this->t['pathcat'], $v->image, 'medium');
		if (isset($image->rel)) {
			echo '<a href="'.JRoute::_(PhocacartRoute::getCategoryRoute($v->id, $v->alias)).'"><img src="'. JURI::base(true).'/'.$image->rel.'" alt="" class="img-responsive ph-image" /></a>';
		}
		
		if ($j == (int)$this->t['cv_display_subcategories']) {
			break;
		}
		echo '<li><a href="'.JRoute::_(PhocacartRoute::getCategoryRoute($v->id, $v->alias)).'">'.$v->title.'</a></li>';
		$j++;
	}
	echo '</ul>';
	echo '<hr />';
}
To customize the design - just use the template or Phoca Cart CSS. You can change the size of the thumbnails too:
FROM:

Code: Select all

$image = PhocacartImage::getThumbnailName($this->t['pathcat'], $v->image, 'medium');
TO:

Code: Select all

$image = PhocacartImage::getThumbnailName($this->t['pathcat'], $v->image, 'small');
Jan