On the category page

сalling the products name like this

<?php echo $product->product_name ?>

Therefore we have $product and not $this->product

On the product page

calling the product name like this

<?php echo $this->product->product_name ?>

because there is only one product available.

  • Product variables are called on the category page with $product->
  • Product variables are called on the product page with $this->

Example

To show a picture in the product detail when a product is not available.

<div style="padding:5px;">
<a><?php if ($this->product->product_in_stock == 0) {echo "<img src='http://mysite/images/red2.png' non disponibile' on-click=\"javascript:window.open('/legenda.html','legenda',')\"";} 
                
?>
</a>
</div>

Product variables are called on the category page with $product-> and NOT $this->

So change for category page

$this-> to $product-> 

<div style="padding:5px;">
<a><?php if ($product->product_in_stock == 0) {echo "<img src='http://mysite/images/red2.png' non disponibile' on-click=\"javascript:window.open('/legenda.html','legenda',')\"";} 
                
?>
</a>
</div>