Magento: Getting Product Url's for Products within a Grouped Product

Posted by Nathan on Stack Overflow See other posts from Stack Overflow or by Nathan
Published on 2009-12-22T23:29:28Z Indexed on 2010/03/27 20:23 UTC
Read the original article Hit count: 681

Filed under:
|
|
|
|

For a grouped product, I would like to display a link to the simple products it is composed of. For example, if I have a grouped product called Dining Set composed of plates, knives, forks, etc. I'd like each of the subproducts to have a link to that subproduct (click plates goes to the Simple Product for plates)

<?php foreach ($_associatedProducts as $_item): ?>
        <tr>
            <td><?php echo $this->htmlEscape($_item->getName()) ?></td>
            <td class="a-right">
                <?php echo $this->getPriceHtml($_item, true) ?>
            </td>
            <?php if ($_product->isSaleable()): ?>
            <td class="a-center">
            <?php if ($_item->isSaleable()) : ?>
    			<a href="<?php $_item->getProductUrl() ?>">View</a>
            <?php else: ?>
                <p class="availability"><span class="out-of-stock"><?php echo $this->__('Out of stock.') ?></span></p>
            <?php endif; ?>
            </td>
            <?php endif; ?>
        </tr>
    <?php endforeach; ?>

This is a code snippet from the grouped.phtml file in app/design/frontend/blank/default/template/catalog/product/view/type/grouped.phtml

In particular the line that has $_item->getProductUrl() This does not work, and I don't know the code needed to get the url for this associated product item. If anyone could help here it would be much appreciated.

Also, where on earth can I find the method's available (and how they're used) for Products or Categories or $_item and the like?

Thanks, Nathan

© Stack Overflow or respective owner

Related posts about magento

Related posts about group