VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: Tkheun on December 20, 2016, 11:54:42 AM

Title: Additional images for categories
Post by: Tkheun on December 20, 2016, 11:54:42 AM
Hi there!

I need to display additional images at category pages. How do I do that?  Normally default template doesn't display even a main image of category.
Title: Re: Additional images for categories
Post by: Studio 42 on December 20, 2016, 23:13:01 PM
The minimum code is :
echo $this->category->images[0]->displayMediaThumb("",false);
in JOOMLAROOT\components\com_virtuemart\views\category\tmpl\default.php
or better in your template do an overide in
YOURTEMPLATE\html\com_virtuemart\category\default.php
Note : some stupid framework can have other subfolders, eg.warp framework used by yootheme, can have 3 or 4 subfolders, i searched 2 hours last day, because vmuikit now add own folder too for layout file overides.
Title: Re: Additional images for categories
Post by: Tkheun on December 21, 2016, 06:52:11 AM
Thank you. But it this code allowed me to display only main image. Additional images still doesn't work :'(
Title: Re: Additional images for categories
Post by: Spiros Petrakis on December 21, 2016, 07:32:43 AM
I think you must first get all the images because they are not available by default


$catModel = VmModel::getModel('Category');
$catModel->addImages($categories);


then echo the images


foreach ($category->images as $image) {
  echo $image->displayMediaThumb("",false);
}
Title: Re: Additional images for categories
Post by: Tkheun on December 21, 2016, 09:10:30 AM
<?php
$catModel 
VmModel::getModel('Category');
$catModel->addImages($categories);

foreach (
$category->images as $image) {
  echo 
$image->displayMediaThumb("",false);
}
?>

Like that? It doesn't work :(

Also I want them to be displayed like images in product - main image on top and additional images below. As I understand there should be separated code to do that?
Title: Re: Additional images for categories
Post by: Studio 42 on December 21, 2016, 09:46:48 AM
Have you try my code?
echo $this->category->images[0]->displayMediaThumb("",false);
Title: Re: Additional images for categories
Post by: Tkheun on December 21, 2016, 10:07:25 AM
Quote from: Studio 42 on December 21, 2016, 09:46:48 AM
Have you try my code?
echo $this->category->images[0]->displayMediaThumb("",false);
Yes. I wrote you an answer above - it shows main image, but doesn't show additionals.
Title: Re: Additional images for categories
Post by: Studio 42 on December 21, 2016, 10:43:04 AM
SO you have to mix my code with Tkheun code, this is the simplified code
<?php
$catModel = VmModel::getModel('Category');
$catModel->addImages($this->category);

foreach ($this->category->images as $image) {
  echo $image->displayMediaThumb("",false);
}
?>
Title: Re: Additional images for categories
Post by: Tkheun on December 21, 2016, 11:07:25 AM
I appreciate your help! This time it worked. This is how it displayed images: http://igc.oscargo.ru/catalog/split-sistemy/comfort (http://igc.oscargo.ru/catalog/split-sistemy/comfort) and this is how I need it to be http://igc.oscargo.ru/catalog/split-sistemy/comfort/ras-rac-07nhg-detail (http://igc.oscargo.ru/catalog/split-sistemy/comfort/ras-rac-07nhg-detail)

Could you tell me how to split the code?
Title: Re: Additional images for categories
Post by: Ghost on December 21, 2016, 11:28:15 AM
See default_images.php and default_images_additional.php in /components/com_virtuemart/views/productdetails/tmpl/.
Title: Re: Additional images for categories
Post by: Tkheun on December 21, 2016, 11:48:07 AM
Quote from: Ghost on December 21, 2016, 11:28:15 AM
See default_images.php and default_images_additional.php in /components/com_virtuemart/views/productdetails/tmpl/.
Looked thru both files. Couldn't make it work.
Title: Re: Additional images for categories
Post by: Tkheun on December 22, 2016, 07:52:46 AM
Mod edit: annoying bump message removed. Please read http://forum.virtuemart.net/index.php?topic=104795.0
Title: Re: Additional images for categories
Post by: Studio 42 on December 22, 2016, 08:19:47 AM
read my answers the last is right and file is
in JOOMLAROOT\components\com_virtuemart\views\category\tmpl\default.php
or better in your template do an overide in
YOURTEMPLATE\html\com_virtuemart\category\default.php
Note : some stupid framework can have other subfolders, eg.warp framework used by yootheme, can have 3 or 4 subfolders, i searched 2 hours last day, because vmuikit now add own folder too for layout file overides.
Title: Re: Additional images for categories
Post by: Tkheun on December 22, 2016, 11:10:49 AM
Quote from: Studio 42 on December 22, 2016, 08:19:47 AM
read my answers the last is right and file is
I have read your answer. Have you read mine? Especially #8 where I sad that I need to split your code?
Title: Re: Additional images for categories
Post by: Studio 42 on December 22, 2016, 20:00:43 PM
Last time


$catModel = VmModel::getModel('Category');
$catModel->addImages($this->category);

foreach ($this->category->images as $image) {
  echo $image->displayMediaThumb("",false);
}

in JOOMLAROOT\components\com_virtuemart\views\category\tmpl\default.php
or better in your template do an overide in
YOURTEMPLATE\html\com_virtuemart\category\default.php
Note : some stupid framework can have other subfolders, eg.warp framework used by yootheme, can have 3 or 4 subfolders, i searched 2 hours last day, because vmuikit now add own folder too for layout file overides.

I cannot explain better.
Title: Re: Additional images for categories
Post by: Tkheun on December 23, 2016, 12:59:16 PM
Quote from: Studio 42 on December 22, 2016, 20:00:43 PM
I cannot explain better.
Just leave it. If you can't get that I DID IT but IT WORKS not the way I need, just move on.
Title: Re: Additional images for categories
Post by: babyonlinecomua on December 26, 2016, 23:33:40 PM
Sorry for my English. Nowhere I can not find the like. How can I implement this?  thanks for answers
http://babyonline.com.ua/tmp/images_probl.jpg