Author Topic: Multiple category images, how to get it  (Read 398 times)

Huubs

  • Jr. Member
  • **
  • Posts: 147
Multiple category images, how to get it
« 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
Code: [Select]
$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:

Code: [Select]
$category->images[1]->file_url

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10377
  • VirtueMart Version: 3+
Re: Multiple category images, how to get it
« Reply #1 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
}
J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)