且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在magento中获取父产品ID?

更新时间:2023-11-30 15:17:40

您可以使用:

$product->getTypeInstance();

哪个将返回您产品的类型对象

Which will return the type object of your product

然后您可以执行以下操作:

Then you can perform your:

->getParentIdsByChild()

最终放弃:

$product->getTypeInstance()->getParentIdsByChild($child->getId());