产品网址不起作用无法点击

时间:2014-04-11 10:23:17

标签: magento

我有以下代码在magento的主页上显示产品。产品显示但我无法单击它并转到产品页面。 有人可以建议一下是什么问题。

 <?php

    //Almost Gone Section
    asort($catalog);
    reset($catalog);
   $almostGoneId = key($catalog);
   $almostGoneStock = $catalog[$almostGoneId];
   $almostGone = Mage::getModel('catalog/product')->load($almostGoneId);


   $_categories = $almostGone->getCategoryIds();
   $_catarray = array();
   foreach ($_categories as $cat) 
   {
    $category = Mage::getModel('catalog/category')->load($cat);
    $_catarray[$category['url_path']] = $category['level'];
    }
   arsort($_catarray);
   $_depth = reset($_catarray);
   $_uri = key($_catarray);

   $url = $this->getUrl($_uri).$almostGone['url_key'].'';
   $almost_gone_price = $almostGone['special_price'];
   ?>
   --><div id="almost_gone" class="product-display-block">
    <div class="display-block">

    <div class="product_display_image">
    <img src="<?php echo $this->helper('catalog/image')-   >init($almostGone, 'image')
   - >constrainOnly(TRUE)->keepAspectRatio(TRUE)->keepFrame(FALSE)->resize(718) ?>" alt="<?    php   echo $almostGone['name'] ?>">
        </div>
        <div class="transparent_title">
            <!-- <span>Almost Gone, Huge Savings</span> --><span    class="display_model">Hurry, Almost Gone Only <?php echo str_replace(".00", "",$_coreHelper->currency($almost_gone_price,true,false)); ?></span>
        </div>
    </div>
    <div class="display_info gone-info">
        <span>Grab A Bargain Today, Only </span><span class="red"><?php echo    *emphasized text*$almostGoneStock ?></span><span> Left</span>
    </div>
    <div class="gone-na">
        <img src="<?php echo $this->getSkinUrl('images/home/gone-na.png') ?>">
    </div>`enter code here`
    <a href="<?php echo $url; ?>"><div class="link-hover"></div></a>
      </div>

1 个答案:

答案 0 :(得分:0)

您的产品网址在哪里?

$url = $product->getProductUrl() //可能就像这样

<a href="<?php echo $url;?>"><img src="<?php echo $this->helper('catalog/image')-   >init($almostGone, 'image')
   - >constrainOnly(TRUE)->keepAspectRatio(TRUE)->keepFrame(FALSE)->resize(718) ?>" alt="<?    php   echo $almostGone['name'] ?>"></a>