PHP产品Url
我有一页下面的代码PHP产品Url,php,magento,Php,Magento,我有一页下面的代码 <?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 $_p
<?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>
您想用哪种产品来替换?有一个环节和许多产品
您可以尝试使用第一个div,该div在每个产品中重复出现,因此我希望该链接是针对当前产品的。如果每个产品都重复出现div,为什么不将其放入循环中呢?此代码非常混乱-请阅读一些更好的编码标准和样式文档(例如PEAR、Horde)
<?php echo $_product->getProductUrl() ?>