5

remove image

I need to remove the image title/name below from product view pages. Magento version 2.2.5. Anyone know how do this?

The expectation is without title/name :)

  • Are you using any theme? – Sukumar Gorai Jul 25 '18 at 8:26
  • please try to remove label name of image – pramod24 Jul 25 '18 at 8:33
  • i am using porto theme. @SukumarGorai – Kean Jul 25 '18 at 9:12
  • @pramod24 do you where to remove label name of image? default didn't give name for image upload on backend. – Kean Jul 25 '18 at 9:12
  • @pramod24 It will not work. – Sukumar Gorai Jul 25 '18 at 9:19
3

You need to override the fotoroma.js from location to your module:

lib/web/fotorama/fotorama.js

Then find showcaption and captions, then set those to false.

Now need to run static content deploy.

I have edited the

lib/web/fotoroma/fotoroma.js

directly This solved my problem.

| improve this answer | |
  • ,can you tell please how to remove product image scroll in details page in fotorama.js – Hitesh Balpande Jan 18 '19 at 12:13
  • Post a question with screenshot, definitely members will answer. – Sukumar Gorai Jan 18 '19 at 12:24
0

Try this:

Create a custom module with below code.

app/code/Vendor/Module/etc/frontend/di.xml

With below code.

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Catalog\Block\Product\View\Gallery">
        <plugin name="get_gallery_images_json_captions" type="Vendor\Module\Plugin\Gallery"/>
    </type>
</config>

Now plugin file

app/code/Vendor/Module/Plugin/Gallery.php

With below code.

<?php

namespace Kunj\Gallery\Plugin;
class Gallery
{
    public function afterGetGalleryImagesJson(
        \Magento\Catalog\Block\Product\View\Gallery $subject,
        $result
    ) {
        $galleryOptions = json_decode($result,1);
        foreach ($galleryOptions as $k => $options)
        {
            if(isset($galleryOptions[$k]) && isset($galleryOptions[$k]['caption']))
            {
                $galleryOptions[$k]['caption'] = "";

            }
        }
        return json_encode($galleryOptions);
    }
}

Now flush the cache and deploy static content.

| improve this answer | |
  • just try it, it doesn't work, i guess somethings about fotorama. – Kean Jul 25 '18 at 15:28
  • Actually, magento display that data from $data varibale wich is in gallery.phtml file and there's bug in magento 2 as if we set caption false in current theme etc/view.xml file under var section. Did you create custom module? – kunj Jul 25 '18 at 18:23
0

Just add to your custom css.

.fotorama__caption{
    visibility: hidden !important;
} 
| improve this answer | |
0

I am also using magento 2 and Porto theme, for people who needs to do it via CSS can follow the following steps:

  • Goto Store > Configurations > Porto theme Settings Panel > Custom CSS

Add following css.

.fotorama__caption__wrap{
display:none !important;

}

After that clear the cache of magento and browser. The caption/label now must be hidden.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.