How to Fix No Image problem in OpenCart

If you want to fix no image file in opencart for product or for all pages where there is no image available, you can do this in two ways:
        1) Global Method                           2) Template method

If you will fix globally then where there will be no image then your no image file will display but when you fix for template then it will work only for product of OpenCart.

Fix no image issue in opencart
Fix no image issue in opencart – PHP Cluster

How to assign the “no_image” file at catalog pages where no image file can be found yet. Later, if the file exists, it will show up.
You can implement it at a global level in catalog/model/tool/image.php or in specific areas at the template level.

1) Global method
You can edit line 16 in catalog/model/tool/image.php
Change this:
CODE: SELECT ALL
return;

To this:
CODE: SELECT ALL
//return;
$filename = “data/no_image.jpg”;

Adjust path and file name to where your actual “no_image” image kept, and no image is applied everywhere.
(In the above example “no_image.jpg” kept inside “image/data/” folder. If it resides in “image” folder, remove the “data” path.)

2) Template method
This is also easy to implement but the actual code implementation depends on your template …
This example explain how it could be done in the default theme of Opencart 1.5.6.4 at product’s page
Open catalog/view/theme/default/template/product/product.tpl

You modify the line 23 of the following code:
CODE: SELECT ALL

<?php if ($thumb || $images) { ?>
    <div class="left">
      <?php if ($thumb) { ?>
      <div class="image"><a href="<?php echo $popup; ?>" title="<?php echo $heading_title; ?>" class="colorbox"><img src="<?php echo $thumb; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" id="image" /></a></div>
      <?php } ?>
      <?php if ($images) { ?>
      <div class="image-additional">
        <?php foreach ($images as $image) { ?>
        <a href="<?php echo $image['popup']; ?>" title="<?php echo $heading_title; ?>" class="colorbox"><img src="<?php echo $image['thumb']; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" /></a>
        <?php } ?>
      </div>
      <?php } ?>
    </div>
    <?php } ?>

Line 23 is the the last line of the above code.
CODE: SELECT ALL

<?php } ?>

This line replaced by code shown below:
CODE: SELECT ALL

<?php } else { ?> 
    <div class="left">
<div class="image"><img src="image/data/no_image.jpg" title="No Image" alt="No Image" id="image" style="width:228px;height:228px;" /></a></div>
    </div>
      <?php } ?>

At the above code define the image file name, path, width and height as you needs.
You can add similar code for same behaviour in any other tempalate.

Also See:

How to use SEO friendly URL in OpenCart