[Solved] Display product name(s) of an order id

Questions around the TYPO3 integration and plugins
Forum rules
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
User avatar
aimeos
Administrator
Posts: 7873
Joined: 01 Jan 1970, 00:00

Re: Display product name(s) of an order id

Post by aimeos » 19 Jan 2021, 10:56

What else do you want to know?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

rowild

Re: Display product name(s) of an order id

Post by rowild » 20 Jan 2021, 09:51

Well, first, i would like to know where

Code: Select all

$orders
comes from?

Because that throws an error: "Call to a member function keys() on null"

:-) Thank you!

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

Re: Display product name(s) of an order id

Post by aimeos » 20 Jan 2021, 10:19

Sorry, this was a left-over from the first try where the decorator called the method of the inner object. It's removed now in the example.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

rowild

Re: Display product name(s) of an order id

Post by rowild » 20 Jan 2021, 16:55

Excellent - thank you!
Next step: How to access products...
Last edited by rowild on 20 Jan 2021, 18:49, edited 1 time in total.

rowild

Re: Display product name(s) of an order id

Post by rowild » 20 Jan 2021, 17:22

Aha, this seems to do it:

Code: Select all

$curr = $orderItem->getBaseItem()->getProducts();

foreach( $curr as $prodId => $product ) {
	echo '<pre>';
	var_export( $prodId . ': ' . $product->get( 'order.base.product.name' ) );
	echo '</pre>';
}

die();
Am I on the right track?

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

Re: [Solved] Display product name(s) of an order id

Post by aimeos » 21 Jan 2021, 17:05

Yes. Instead of the "magic" get() method, you should use e.g. getName() to retrieve the product name because the item methods will return default values instead of NULL like get() does. For the list of available methods, have a look at the interface:
https://github.com/aimeos/aimeos-core/b ... /Iface.php
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply