Jump to content

"NO IMAGE AVAILABLE" image not shown


keanu

Recommended Posts

Hey guys

 

Some of the products in my shop doesn't have images and I expect that Prestashop 1.7 shows the default "no image available" image for the product automatically. But it doesn't. It worked perfectly in Prestashop 1.6. Info about my shop:

 

I use Prestashop 1.7.04, I have 777 for "p" folder in images, both en.jpg and sv.jpg (for my swedish website) exist in "p" folder. 

 

All other images for the products which have images are shown without problem.

 

What can be done? What can be the problem? I have searched about this but found nothing....

 

 

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
  • 2 weeks later...
  • 1 month later...
  • 4 weeks later...

Hello,

I managed to solve this issue by changing the following code:

 

For product list:

open themes\classic\templates\catalog\_partials\miniatures\product.tpl and change:

 

{block name='product_thumbnail'}
      <a href="{$product.url}" class="thumbnail product-thumbnail">
          <img
            src = "{$product.cover.bySize.home_default.url}"
            alt = "{$product.cover.legend}"
            data-full-size-image-url = "{$product.cover.large.url}"
          >
        </a>
      {/block}

 

to

 

{block name='product_thumbnail'}
      {if empty($product.cover.bySize.home_default.url)}
        <a href="{$product.url}" class="thumbnail product-thumbnail">
          <img
            src = "
link_to_your_image"
            alt = "{$product.cover.legend}"
            data-full-size-image-url = "{$product.cover.large.url}"
          >
        </a>    
      {else}
        <a href="{$product.url}" class="thumbnail product-thumbnail">
          <img
            src = "{$product.cover.bySize.home_default.url}"
            alt = "{$product.cover.legend}"
            data-full-size-image-url = "{$product.cover.large.url}"
          >
        </a>
        {/if}
      {/block}

 

For product page:

open themes\classic\templates\catalog\_partials\product-cover-thumbnails.tpl and change:

 

{block name='product_cover'}
     <div class="product-cover">
      <img class="js-qv-product-cover" src="{$product.cover.bySize.large_default.url}" alt="{$product.cover.legend}" title="{$product.cover.legend}" style="width:100%;" itemprop="image">
      <div class="layer hidden-sm-down" data-toggle="modal" data-target="#product-modal">
        <i class="material-icons zoom-in"></i>
      </div>
    </div>
  {/block}

 

to

 

{block name='product_cover'}
  {if empty($product.cover.bySize.large_default.url)}
    <div class="product-cover">
      <img class="js-qv-product-cover" src="
link_to_your_image" alt="{$product.cover.legend}" title="{$product.cover.legend}" style="width:100%;" itemprop="image">
    </div>
  {else}
    <div class="product-cover">
      <img class="js-qv-product-cover" src="{$product.cover.bySize.large_default.url}" alt="{$product.cover.legend}" title="{$product.cover.legend}" style="width:100%;" itemprop="image">
      <div class="layer hidden-sm-down" data-toggle="modal" data-target="#product-modal">
        <i class="material-icons zoom-in"></i>
      </div>
    </div>
  {/if}
  {/block}

Link to comment
Share on other sites

  • 3 months later...

ABSOLUTELY NO reply or action from Prestashop on this issue, despite the fact that many user have the same problem/bug?!

 

Is image issue not an important issue for ecommerce and Prestashop anymore?

 

Please reply, Prestashop.

 

 

Link to comment
Share on other sites

  • 1 year later...
On 5/30/2017 at 4:25 AM, llukas said:

Hello,

I managed to solve this issue by changing the following code:

 

For product list:

open themes\classic\templates\catalog\_partials\miniatures\product.tpl and change:

 

{block name='product_thumbnail'}
      <a href="{$product.url}" class="thumbnail product-thumbnail">
          <img
            src = "{$product.cover.bySize.home_default.url}"
            alt = "{$product.cover.legend}"
            data-full-size-image-url = "{$product.cover.large.url}"
          >
        </a>
      {/block}

 

to

 

{block name='product_thumbnail'}
      {if empty($product.cover.bySize.home_default.url)}
        <a href="{$product.url}" class="thumbnail product-thumbnail">
          <img
            src = "
link_to_your_image"
            alt = "{$product.cover.legend}"
            data-full-size-image-url = "{$product.cover.large.url}"
          >
        </a>    
      {else}
        <a href="{$product.url}" class="thumbnail product-thumbnail">
          <img
            src = "{$product.cover.bySize.home_default.url}"
            alt = "{$product.cover.legend}"
            data-full-size-image-url = "{$product.cover.large.url}"
          >
        </a>
        {/if}
      {/block}

 

For product page:

open themes\classic\templates\catalog\_partials\product-cover-thumbnails.tpl and change:

 

{block name='product_cover'}
     <div class="product-cover">
      <img class="js-qv-product-cover" src="{$product.cover.bySize.large_default.url}" alt="{$product.cover.legend}" title="{$product.cover.legend}" style="width:100%;" itemprop="image">
      <div class="layer hidden-sm-down" data-toggle="modal" data-target="#product-modal">
        <i class="material-icons zoom-in"></i>
      </div>
    </div>
  {/block}

 

to

 

{block name='product_cover'}
  {if empty($product.cover.bySize.large_default.url)}
    <div class="product-cover">
      <img class="js-qv-product-cover" src="
link_to_your_image" alt="{$product.cover.legend}" title="{$product.cover.legend}" style="width:100%;" itemprop="image">
    </div>
  {else}
    <div class="product-cover">
      <img class="js-qv-product-cover" src="{$product.cover.bySize.large_default.url}" alt="{$product.cover.legend}" title="{$product.cover.legend}" style="width:100%;" itemprop="image">
      <div class="layer hidden-sm-down" data-toggle="modal" data-target="#product-modal">
        <i class="material-icons zoom-in"></i>
      </div>
    </div>
  {/if}
  {/block}

This does work for prestathop 1.7. thanks Llukas

  • Like 1
Link to comment
Share on other sites

  • 9 months later...

I did some hotfix, will be resolving this in few weeks, I I'll remember, will put fix here. 
Hotfix for now - replace in .htaccess:
Replace "localhost:8080" with your url.

RewriteCond %{HTTP_HOST} ^localhost:8080$
RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$1$2$3.jpg [L]
RewriteCond %{HTTP_HOST} ^localhost:8080$
RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$1$2$3$4.jpg [L]
RewriteCond %{HTTP_HOST} ^localhost:8080$
RewriteRule ^([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$1$2$3$4$5.jpg [L]
RewriteCond %{HTTP_HOST} ^localhost:8080$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg [L]
RewriteCond %{HTTP_HOST} ^localhost:8080$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg [L]
RewriteCond %{HTTP_HOST} ^localhost:8080$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg [L]
RewriteCond %{HTTP_HOST} ^localhost:8080$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg [L]
RewriteCond %{HTTP_HOST} ^localhost:8080$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg [L]
RewriteCond %{HTTP_HOST} ^localhost:8080$
RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2$3.jpg [L]
RewriteCond %{HTTP_HOST} ^localhost:8080$
RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2.jpg [L]


Problem is, that in <img> is empty src - like "something/.jpg"

If you like it, Like my post pls.
 

Edited by haunter (see edit history)
Link to comment
Share on other sites

  • 1 year later...

Hi!  In my htaccess file there are no configuration lines.  

I already disabled the friendly url, I deleted the htacces, then I enabled to recreate and, also it did not solve.  
Below my htaccess
 

Domain: bellamagerrima.com.br
RewriteRule . - [E=REWRITEBASE:/]
RewriteRule ^api(?:/(.*))?$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]

# AlphaImageLoader for IE and fancybox
RewriteRule ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 [L]
</IfModule>

AddType application/vnd.ms-fontobject .eot
AddType font/ttf .ttf
AddType font/otf .otf
AddType application/font-woff .woff
AddType font/woff2 .woff2
<IfModule mod_headers.c>
    <FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|svg)$">
        Header set Access-Control-Allow-Origin "*"
    </FilesMatch>

    <FilesMatch "\.pdf$">
      Header set Content-Disposition "Attachment"
      Header set X-Content-Type-Options "nosniff"
    </FilesMatch>
</IfModule>

<Files composer.lock>
    # Apache 2.2
    <IfModule !mod_authz_core.c>
        Order deny,allow
        Deny from all
    </IfModule>

    # Apache 2.4
    <IfModule mod_authz_core.c>
        Require all denied
    </IfModule>
</Files>
#If rewrite mod isn't enabled
ErrorDocument 404 /index.php?controller=404

# ~~end~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again

# php -- BEGIN cPanel-generated handler, do not edit
# Defina o pacote “ea-php72” como a linguagem padrão de programação “PHP”.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php72 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...