I have the below code in a page.
<?php if($this->getMode()!='grid'): ?>
<?php $_iterator = 0; ?>
<div class="listing-type-list catalog-listing top10full" onclick='window.open("http://google.com")'>
<?php
$i = 0;
foreach ($_productCollection as $_product):
$i++;
?>
<div class="listing-number"><p class="listing-position"><?php echo $i ?></p></div>
<div class="listing-item<?php if( ++$_iterator == sizeof($_productCollection) ): ?> last<?php endif; ?>">
<?php // Product Image ?>
<div class="product-image">
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getSmallImageLabel()) ?>">
<img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135, 135); ?>" width="135" height="135" alt="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')) ?>" title="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')) ?>" />
</a>
</div>
I would like to replace http://google.com with the product url:
<?php echo $_product->getProductUrl() ?>
However the above way of getting the product url only works when inside the foreach loop.
How can I get this to work?