Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Calling ->getUsedProducts() question
 
Darokthar
Jr. Member
 
Total Posts:  10
Joined:  2012-08-21
 

I tried to call ->getUsedProducts() of a configurable product from design/frontend/../../template/catalog/product/view/description.phtml

My first approach looked like this:

<?php if( $_product->canConfigure() ): ?>
    <?php $_usedProducts 
$_product->getUsedProducts(null$_product?>
    <?php 
foreach($_usedProducts as $product):?>
    <?php 
if( $product->getData('isbn') != '' ): ?>
        
<class='isbn'<?php echo $product->getData('design') . ' ISBN: ' ?> <span><?php echo $product->getData('isbn'?></span></p>
    
<?php endif; ?>
    <?php 
endforeach; ?>
<?php 
endif; ?>

But this does not work. What is the difference to this:

<?php if( $_product->canConfigure() ): ?>
    <?php $_usedProducts 
Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null$_product?>
    <?php 
foreach($_usedProducts as $product):?>
    <?php 
if( $product->getData('isbn') != '' ): ?>
        
<class='isbn'<?php echo $product->getData('design') . ' ISBN: ' ?> <span><?php echo $product->getData('isbn'?></span></p>
    
<?php endif; ?>
    <?php 
endforeach; ?>
<?php 
endif; ?>

which creates the output?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top