We changed our privacy policy. Read more.

Hot answers tagged

10

We can override the less file lib in our custom theme. Put this file under web folder: app/design/frontend/{Vendor}/{Theme}/web/mage/gallery/gallery.less and add mage/gallery/gallery in PROJECT/dev/tools/grunt/configs/themes.js (or PROJECT/dev/tools/grunt/configs/local-themes/themes.js for magento 2.2) to make grunt compiling it as well.


8

Apart from: catalog_product_entity_media_gallery and catalog_product_entity_media_gallery_value tables, now Magento 2 has one more table catalog_product_entity_media_gallery_value_to_entity, which keeps track of removal of product in catalog_product_entity table, and relates this table to catalog_product_entity_media_gallery. You need to check ...


7

Since addImageToMediaGallery is not added to interface \Magento\Catalog\Api\Data\ProductInterface, I'd not recommend to use addImageToMediaGallery with ProductRepository. For better practice you can try to use Magento2 Service Layer. You can save a new image using \Magento\Catalog\Api\ProductAttributeMediaGalleryManagementInterface::create If you will go ...


7

Override fotorama.js in your custom theme at app/design/<vendor>/<custom_theme>/web/fotorama/fotorama.js, you can copy this file from \lib\web\fotorama\fotorama.js and replace code as per below at line no. 1220 From function stubEvent($el, eventType) { $el.on(eventType, function (e) { stopEvent(e, true); return false; ...


7

Based on mohit's answer: truncate catalog_product_entity_media_gallery_value; truncate catalog_product_entity_media_gallery_value_to_entity; delete from catalog_product_entity_media_gallery; # 9 sec delete from catalog_product_entity_varchar where attribute_id in ( select attribute_id from eav_attribute where attribute_code like "%image" and ...


6

create helper for example : <?php /** * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ namespace Ibnab\Common\Helper; use Magento\Catalog\Model\Product\Gallery\ReadHandler as GalleryReadHandler; class Data extends \Magento\Framework\App\Helper\AbstractHelper { protected $galleryReadHandler; /** * ...


5

Say you wanted to make sure that all "Base" images were unhidden. You could run a SQL Query like: UPDATE `catalog_product_entity_media_gallery_value` SET `disabled` = 0 WHERE `value_id` IN ( SELECT `value_id` FROM `catalog_product_entity_media_gallery` WHERE `value` IN ( SELECT `value` FROM `catalog_product_entity_varchar` WHERE `...


4

You need to set catalog_product_entity_media_gallery and catalog_product_entity_media_gallery_value the disabled-column to 0 and apply it. or: Use Below Sql Query For Enable All The Hidden Product Images UPDATE `catalog_product_entity_media_gallery_value` SET `disabled`= 0 WHERE DISABLED = 1 and UPDATE `catalog_product_entity_media_gallery` SET `...


4

By adding the following code to the theme's view.xml the image from the simple product is now added to the product gallery rather than replacing the one associated with the configurable product. <vars module="Magento_ConfigurableProduct"> <var name="gallery_switch_strategy">prepend</var> </vars>


3

Generally the image's alt description comes from the "Label" field saved for the product image. Snippet from the base theme's default code: <p class="product-image product-image-zoom"> <?php $_img = '<img id="image" src="'.$this->helper('catalog/image')->init($_product, 'image').'" alt="'.$this->escapeHtml($this->...


3

You can get the image, thumbnail and any other image attribute value from the product directly. $image = $product->getImage(); $thumb = $product->getThumbnail(); .... Try to view product and image as 2 separate entities in a 0 to n relation. A product can have o to n associated images. But the image, thumbnail and small image are product ...


3

There's a lot of stuff going on to give you those urls. If you really want to swap it to insecure, the easiest way is probably to run str_replace(Mage::getBaseUrl('media', true), Mage::getBaseUrl('media', false), $imageUrl, 1)


3

Try passing an array as the media type. Theer is no need to iterate over each mediaType and setting them individually. your code would thus be, which will be faster as well. ini_set('memory_limit', '-1'); require 'app/Mage.php'; Mage::app(); echo "Loading catalog...\n"; $products = Mage::getModel('catalog/product')->setStoreId(13)->getCollection()-&...


3

You must have to put your images in media folder and est full path. Please check the below code i changed. <?php require_once 'app/Mage.php'; Mage::app(); Mage::app()->getStore()->setId(Mage_Core_Model_App::ADMIN_STORE_ID); $importDir = Mage::getBaseDir('media') . DS . 'bulkimages/101/'; $productsData = array('Purple-Crown-Ring-MFAS.jpg','Purple-...


3

Actually, I found something! If you think there is a better solution, please comment or provide your own. You can attach an event to the loading of the gallery and also to the change of the option value. When one changes, call 'seek' on the gallery. This uses the Magento Gallery API, which you can find more info about HERE. The API docs don't discuss ...


3

Check the catalog_product_entity_media_gallery table in database here in 'value' column image path is saved For writing custom query for this table you need to use core_read and core_write connection to update the table. For Read Connection : $readConnection = Mage::getSingleton('core/resource')->getConnection('core_read'); $sql = "SELECT * ...


3

I got the solution after some R&D on fotorama.js I override the file of fotorama.js in My_Theme. app/design/[My]/[Theme]/web/fotorama/fotorama.js I want to Enable both gallery nav arrow and don't want to hide nav arrow when slider goes up and down in vertical way arrow. Also i want to enable that arrow only if image is more than 4. Lets see in ...


3

You can use getProduct() function directly in this file because that extends below file which contain this function. vendor/magento/module-catalog/Block/Product/View/AbstractView.php You can use below line to get Product ID in that file.. <?php $productId = $this->getProduct()->getId(); ?> And you can get attribute value using this line &...


2

Table columns The columns are hard coded in catalog/product/helper/gallery.phtml, this template is used by Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Gallery_Content which again is created programmatically so you cannot affect it via layout XML. The block has its own event catalog_product_gallery_prepare_layout that's dispatched before rendering, so ...


2

Have you called $product->save() method after below code? if (!$product->hasSmallImage()) $product->setSmallImage($product->getImage()); if (!$product->hasThumbnail()) $product->setThumbnail(Mage::helper('catalog/image')->init($product, array('thumbnail','small_image','image'))); Update:: set the Small Image, Thumbnail and image....


2

If I understand correctly you are using Magento DataFlow export which is quite outdated. I suggest using Magento's ImportExport (System\ImportExport\Export). It exports all gallery images into a _media_image column.


2

Edit this CSS file http://theme8.newtrendzonline.com/ma_aries_quickstart_1.8.0.0/skin/frontend/default/ma_aries_man/magentothem/css/ma.banner7.css Go to Line no. 42 Make cahanges like following: .ma-banner7-container .flexslider { margin: 0 0 20px; max-height: 500px; position: relative; } here I have added only max-...


2

What you can do is, take what the method is returning, strip the baseurl from it, so you have the path in /media/ and then use getimagesize


2

this seems to be a bug in the Api. Looking at the Rest Api Documentation of the catalogProductAttributeMediaGalleryManagementV1 Resource, the Image Content seems to be required while the Video content is optional: http://devdocs.magento.com/swagger/index.html


2

It is required to set catalog_product_entity_media_gallery disabled column to 0 and it appears


2

In Product admin go to the Image Tab, then select the "Small Image" checkbox next to the image you want to display on your product listing page. See app/design/frontend/base/default/template/catalog/product/list.phtml <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>


2

After some research on how to override a function on a Model, I've created my own module/extension. This extension extends the Mage_Catalog_Model_Product_Image Model and this is what I've changed to make it work: class ImageCdn_Model_Catalog_Product_Image extends Mage_Catalog_Model_Product_Image { protected $_cdnFile; public function setBaseFile($...


2

I like Swipebox: http://brutaldesign.github.io/swipebox/#dynamic It is fast, clean and perfect on mobile too. Also there is this extention: http://www.magentocommerce.com/magento-connect/jquery-lightboxes-fancybox-pirobox-etc.html ..which lets you try different Lightboxes within one extention.


2

Pretty sure you have to initialize the media gallery first. I've done that several times and the code I used was always like this: ->setMediaGallery( [ 'images'=> [], 'values'=> [] ] ) // Media gallery initialization ->addImageToMediaGallery( $image, [ 'image', 'thumbnail', 'small_image' ...


2

In your custom config file for Grunt add path to gallery file: 'mage/gallery/gallery' along with 'css/styles-m' and 'css/styles-l'


Only top voted, non community-wiki answers of a minimum length are eligible