Magento:在结帐成功页面上仅显示简单产品

Magento: Showing only simple products on checkout success page

我已成功显示结帐成功时订购的产品 (success.phtml),但问题是它在我需要时显示可配置的 关联的简单产品只显示简单的。我尝试按以下方式进行操作,但它没有显示任何内容。我什至不能在 $item 上使用 typeof,所以显然做错了什么。 有人会好心地看一下我的代码并给我一个关于如何让它正常工作的提示吗?干杯。

<?php $order_id = 

Mage::getSingleton('checkout/session')->getLastRealOrderId();
$order_details = Mage::getModel('sales/order')->loadByIncrementId($order_id); 
foreach ($order_details->getAllItems() as $item): ?>
<?php if ($item->getParentProductId()): ?>
<h4> <?php echo $item->getName(); ?> </h4>
<br />
<h4>Quantity: <?php echo round($item->getQtyOrdered(), 0); ?> </h4>
<br />
<img src="<?php echo $this->helper('catalog/image')->init($item, 'small_image')->resize(200); ?>" width="200" height="200" class="media-object img-responsive" alt="<?php echo $this->getImageLabel($item, 'small_image'); ?>"/>
<?php endif; ?>
<?php endforeach; ?>

基本上看产品对象的类型,这是未经测试的,所以我不知道它是否有效,但你明白了。

Mage::getSingleton('checkout/session')->getLastRealOrderId();
$order_details = Mage::getModel('sales/order')->loadByIncrementId($order_id); 
foreach ($order_details->getAllItems() as $item): ?>
<?php if ($item->getProduct()->getTypeID() == 'simple'): ?>
<h4> <?php echo $item->getName(); ?> </h4>
<br />
<h4>Quantity: <?php echo round($item->getQtyOrdered(), 0); ?> </h4>
<br />
<img src="<?php echo $this->helper('catalog/image')->init($item, 'small_image')->resize(200); ?>" width="200" height="200" class="media-object img-responsive" alt="<?php echo $this->getImageLabel($item, 'small_image'); ?>"/>
<?php endif; ?>
<?php endforeach; ?>