Catalog media get configuration options

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
User avatar
Dinver
Posts: 27
Joined: 26 Oct 2020, 08:42

Catalog media get configuration options

Post by Dinver » 04 Nov 2020, 14:21

Hi! I wanted to do slider of catalog media. How i can get configuration options?

Image

Dump does not contain this data.

Code: Select all

Aimeos\MShop\Media\Item\Standard {#2087 ▼
  -langid: "ru"
  -prefix: "media."
  -available: true
  -modified: false
  #bdata: array:14 [▼
    "media.id" => "33"
    "media.siteid" => "1."
    "media.languageid" => null
    "media.type" => "stage"
    "media.url" => "files/8/a/8acc69c8_1669842697.jpg"
    "media.label" => "yes.jpg"
    "media.status" => "1"
    "media.mimetype" => "image/jpeg"
    "media.domain" => "catalog"
    "media.previews" => array:3 [▼
      240 => "preview/8/7/87721256_713301927.jpg"
      720 => "preview/2/3/233eee02_679499300.jpg"
      1280 => "preview/d/6/d6ed2fd0_1213870932.jpg"
    ]
    "media.mtime" => "2020-11-04 13:09:06"
    "media.editor" => "admin@admin.com"
    "media.ctime" => "2020-11-04 12:55:45"
    ".languageid" => "ru"
  ]
  -listItems: []
  -listRefItems: []
  -listRmItems: []
  -listPrepared: false
  -listRmMap: []
  -listMap: []
  -listMax: 0
  -propItems: []
  -propRmItems: []
  -propMax: 0
}

User avatar
aimeos
Administrator
Posts: 7889
Joined: 01 Jan 1970, 00:00

Re: Catalog media get configuration options

Post by aimeos » 07 Nov 2020, 08:18

These settings aren't part of the media item but of the list item referencing the media item. To get that data, you must use:

Code: Select all

foreach( $product->getListItems( 'media', 'default', 'stage' ) as $listItem ) {
	$listItem->getConfig(); // all key/value pairs
	$listItem->getConfigValue( 'to' ); // single value for 'to'
	$listItem->getRefItem(); // media item
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
Dinver
Posts: 27
Joined: 26 Oct 2020, 08:42

Re: Catalog media get configuration options

Post by Dinver » 09 Nov 2020, 06:50

aimeos wrote: 07 Nov 2020, 08:18

Code: Select all

$product->getListItems( 'media', 'default', 'stage' )
I need home page, $product no value

Code: Select all

$this->homeTree->getListItems( 'media', 'default', 'stage' )
returns an empty array.

User avatar
aimeos
Administrator
Posts: 7889
Joined: 01 Jan 1970, 00:00

Re: Catalog media get configuration options

Post by aimeos » 10 Nov 2020, 09:59

Check if

Code: Select all

$this->homeTree->getListItems( 'media' )
returns an image at all. If not, the images are not loaded at all and there's something wrong. The code that loads the categories and their images is here:
https://github.com/aimeos/ai-client-htm ... #L438-L462
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
Dinver
Posts: 27
Joined: 26 Oct 2020, 08:42

Re: Catalog media get configuration options

Post by Dinver » 10 Nov 2020, 11:40

aimeos wrote: 10 Nov 2020, 09:59 Check if

Code: Select all

$this->homeTree->getListItems( 'media' )
returns an image at all. If not, the images are not loaded at all and there's something wrong. The code that loads the categories and their images is here:
https://github.com/aimeos/ai-client-htm ... #L438-L462

Code: Select all

$this->homeTree->getListItems( 'media' )
Thanks! Returned exactly what is needed.

Post Reply