VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: Kuubs on October 24, 2019, 15:32:08 PM

Title: Multiple category images, how to get it
Post by: Kuubs on October 24, 2019, 15:32:08 PM
Hello,

You have the possibility to insert multiple images in the category in the administrator section of the website. How can I access these?

The $this->category->file_url always displays the first image.

Its about the category page. I want to display the first one for the category view, but the second on as main image on my child category page.

This also doesn't work:

$category->images[1]->file_url
Title: Re: Multiple category images, how to get it
Post by: PRO on October 25, 2019, 17:37:34 PM


from where?


foreach ($this->category->images as $img){

// do something here
}


$this->   if for the current category only.



ALSO:

If you have the category IDs


$categories=1,2,3 ;
$categoryModel = VmModel::getModel('Category');
$categoryModel->addImages($categories);

then
foreach ($category->images as $img){

// do something here
}