Get parent product

Help for integrating the Laravel package
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!
jramirezgranada
Posts: 40
Joined: 12 Jul 2018, 19:57

Get parent product

Post by jramirezgranada » 27 Nov 2018, 14:20

Hi there;

I have a selection products with 3 variants product, is there a way to know what is the parent product of those variants ?

Thanks
--
Jorge A Ramirez
System Engineer
PHP Developer

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

Re: Get parent product

Post by aimeos » 27 Nov 2018, 17:11

You can search for the parent product in 2018.10 using:

Code: Select all

$manager = \Aimeos\MShop\Factory::createManager( $context, 'product' );
$criteria = $manager->createSearch();
$func = $criteria->createFunction( 'product:has', ['product', 'default', '<prodid>'] );
$criteria->setConditions( $criteria->compare( '!=', $func, null ) );
$items = $manager->searchItems( $criteria );
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

jramirezgranada
Posts: 40
Joined: 12 Jul 2018, 19:57

Re: Get parent product

Post by jramirezgranada » 27 Nov 2018, 17:18

Does it work in 2017.07 ?

Thanks
--
Jorge A Ramirez
System Engineer
PHP Developer

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

Re: Get parent product

Post by aimeos » 27 Nov 2018, 17:20

No, but you should update nevertheless because 2018.07 isn't supported any more 2018.10 is the new LTS version.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

jramirezgranada
Posts: 40
Joined: 12 Jul 2018, 19:57

Re: Get parent product

Post by jramirezgranada » 27 Nov 2018, 17:22

Sorry 2018.07, it does it work in that version?
--
Jorge A Ramirez
System Engineer
PHP Developer

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

Re: Get parent product

Post by aimeos » 28 Nov 2018, 23:43

Also no. It's new in 2018.10 and you should upgrade too. The upgrade between that versions should be smooth.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply