这是我的代码。
$storeId = Mage::app()->getStore()->getId();
$session = Mage::getSingleton('checkout/session');
foreach($session->getQuote()->getAllItems() as $item)
{//how to find parent id here}
在上面提到的评论中,我想访问该特定产品的父 ID。 请帮忙..
最佳答案
试试下面的代码,也许会对你有帮助
if($item->getTypeId() == "simple"){
$parentIds = Mage::getModel('catalog/product_type_grouped')->getParentIdsByChild($item->getId()); // check for grouped product
if(!$parentIds)
$parentIds = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($item->getId()); //check for config product
}
关于magento - 在magento中查找产品的父ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16542960/