News:

Support the VirtueMart project and become a member

Main Menu

Multiple category images, how to get it

Started by Kuubs, October 24, 2019, 15:32:08 PM

Previous topic - Next topic

Kuubs

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

PRO



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
}