Phantom Hyperlinks

Hi guys,

I’ve been working with the E-commerce CMS Opencart the last few months and I know it pretty well by know but I am getting the weirdest view render issue which only seems to manifest on Firefox 3.6. Each product is rendered out in a table and is hyper linked by wrapping it with the hyperlink with class wrap_link. This is fine the first time the page renders but every now and again (completely random and intermittent), I visit another page in the store and when I return to the page with the code below, wrap link is populated with several ghostly occurrences of itself(see second code example).

As you can imagine this causes chaos with the layout and is not good especially as its my main product page. The hyperlink for the products is Opencart generated so it definitely isn’t an issue with the way that is constructed and why would it work first time if it wasn’t?


<?php if ($products) { ?>

<div class="divider_top">
<h2 class="latest_title">Most Wanted</h2>
    <div class="middle">
    <table class="list">
      <?php for ($i = 0; $i < sizeof($products); $i = $i + 3) { ?>
      <tr>
        <?php for ($j = $i; $j < ($i + 3); $j++) { ?>
        <td ><?php if (isset($products[$j])) { ?>
	<div class="prod_name"><?php echo $products[$j]['name']; ?></div>		
        <a class="wrap_link" href="<?php echo $products[$j]['href']; ?>">
        <!--[if IE 7]>
          <img src="<?php echo $products[$j]['thumb']; ?>"
          title="<?php echo $products[$j]['name']; ?>" width="30%"
          alt="<?php echo $products[$j]['name']; ?>" />
        <![endif]-->
        <![if !IE 7]>
          <img src="<?php echo $products[$j]['thumb']; ?>" title="<?php echo $products[$j]['name']; ?>" width="34%" height="190"  alt="<?php echo $products[$j]['name']; ?>" />
        <![endif]>

        <div class="list_prod_data">
          <div class="phone_free">£PhoneFree</div>
          <img class="network_logo" src="<?php echo $phone_data[$j]['network_image']; ?>"
          title="<?php echo $phone_data[$j]['network']; ?>" width="33" height="33"
          alt="<?php echo $phone_data[$j]['network']; ?>" />
         <div class="network_specific_text">
            <?php echo $phone_data[$j]['network_internet']; ?>
            <?php echo $phone_data[$j]['minutes']; ?>
            <?php echo $phone_data[$j]['texts']; ?>
            <?php echo $phone_data[$j]['data']; ?>
         </div>
         <?php echo $phone_data[$j]['contract']; ?>
         <span class="view_button">View</span>
       </div>

       <div class="additional">
         <div class="extra_info"><?php echo $phone_data[$j]['extra_info']; ?></div>
         <div class="also_available"><?php echo $phone_data[$j]['also_available']; ?></div>
       </div>


       <div class="label_small">
           <?php if ($display_price) { ?>
           <?php if (!$products[$j]['special']) { ?>
           <span class="price_big"><?php echo $products[$j]['price']; ?></span>
           <?php } else { ?>
           <span class="promo_price"><?php echo $products[$j]['price']; ?></span><span class="price_big"><?php echo $products[$j]['special']; ?></span>
           <?php } ?>
           <?php } ?>
        </div>
         <?php } ?>
         </a>


 <div class="view_more"><a href="<?php echo $phone_data[$j]['manufacturer_link']; ?>"><?php echo $phone_data[$j]['view_more']; ?></a></div>
  <canvas class="html5_price" width="70" height="70"></canvas>
      </td>

      <?php } ?>
    </tr>
    <?php } ?>
  </table>
</div>

</div>
<?php } ?>




<td>
<div class="prod_name">Blackberry 9800</div>
<a class="wrap_link" href="http://www.wavemobilephones.com/index.php?route=product/product&product_id=1214">
<img height="190" width="34%" alt="Blackberry 9800" title="Blackberry 9800" src="http://www.wavemobilephones.com/image/cache/data/blackberry_9800-200x200.jpg" style="opacity: 1;">
</a>
<div class="list_prod_data">
<a class="wrap_link" href="http://www.wavemobilephones.com/index.php?route=product/product&product_id=1214"> </a>
<div class="phone_free">
</div>
<a class="wrap_link" href="http://www.wavemobilephones.com/index.php?route=product/product&product_id=1214">
</a>
<div class="network_specific_text">
<a class="wrap_link" href="http://www.wavemobilephones.com/index.php?route=product/product&product_id=1214">
</a>
</div>
<a class="wrap_link" href="http://www.wavemobilephones.com/index.php?route=product/product&product_id=1214">
</a>
</div>
<a class="wrap_link" href="http://www.wavemobilephones.com/index.php?route=product/product&product_id=1214"> </a>
<div class="additional">
</div>
<a class="wrap_link" href="http://www.wavemobilephones.com/index.php?route=product/product&product_id=1214"> </a>
<div class="label_small">
</div>
<a class="wrap_link" href="http://www.wavemobilephones.com/index.php?route=product/product&product_id=1214"> </a>
<div class="view_more">
</div>
<canvas class="html5_price" height="70" width="70"></canvas>
</td>

Can anyone please help, I am a pretty good developer but I am completely stumped on this one and have already spend LOTS of time. I can’t see how it can be anything else other than a PHP bug :frowning:

Ok think I have a solution, it seems to a mark-up issue because I am using <div> inside <a>.
I have changed it to <span> and it is working ok but don’t quote me on that as it’s very intermittent. Let me know if anyone can spot anything else,

thanks

You also have a closiung anchor </a> in the first block of codeabove and I don’t see an opening.

Edit: Sorry I found the opening, you are doing a lot of stuff within making that link that may cause issues.

Hi thanks for your interest rguy, the opener is there on line 12, easy to miss :wink: