Access to list of the related item
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
- ahmed31916
- Advanced
- Posts: 148
- Joined: 14 Apr 2022, 12:15
Access to list of the related item
Hello,
I have this collection:
How can I access to the price value?
I tried like this:
But didn't work!
I have this collection:
Code: Select all
^ Aimeos\Map {#1286 ▼
#list: array:3 [▼
18 => Aimeos\MShop\Product\Item\Standard {#1358 ▼
-date: "2022-05-06 17:30:00"
-available: true
-modified: false
-prefix: "product."
#bdata: array:20 [▶]
-listItems: array:4 [▶]
-listRefItems: array:4 [▼
"catalog" => array:2 [▶]
"media" => array:1 [▶]
"price" => array:1 [▼
63 => Aimeos\MShop\Price\Item\Standard {#1364 ▼
-currencyid: "EUR"
-tax: null
-precision: 2
-available: true
-modified: false
-prefix: "price."
#bdata: array:18 [▶]
-listItems: []
-listRefItems: []
-listRmItems: []
-listPrepared: false
-listRmMap: []
-listMap: []
-listMax: 0
-propItems: []
-propRmItems: []
-propMax: 0
}
]
"text" => array:1 [▶]
]
-listRmItems: []
-listPrepared: false
-listRmMap: []
-listMap: []
-listMax: 7
-propItems: []
-propRmItems: []
-propMax: 0
}
23 => Aimeos\MShop\Product\Item\Standard {#1276 ▶}
25 => Aimeos\MShop\Product\Item\Standard {#1375 ▶}
]
#sep: "/"
}
I tried like this:
Code: Select all
$item['price.value']
Re: Access to list of the related item
Use getRefItems(): https://aimeos.org/docs/latest/models/m ... nced-items
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
- ahmed31916
- Advanced
- Posts: 148
- Joined: 14 Apr 2022, 12:15
Re: Access to list of the related item
thank you.
I wonder, Is this Ok?
Using getRefItem() in a blade, made me to add foreach loop for every related list. That mean I consumes site performance.
Is there another solution?
I wonder, Is this Ok?
Using getRefItem() in a blade, made me to add foreach loop for every related list. That mean I consumes site performance.
Is there another solution?
Code: Select all
@foreach ($products as $item)
{{$item['product.label']}}
@foreach ($item->getRefItems('price') as $itemee)
{{($itemee->getValue() ?? '')}}
{{($itemee->getCurrencyId() ?? '')}}
@endforeach
@endforeach
- Attachments
-
- Screenshot 2022-05-07 160355.png (39.95 KiB) Viewed 668 times
Re: Access to list of the related item
No, it's OK because you want to output all products and all prices.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star