Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Magento-显示不是基础、小图片或拇指的图像_Magento - Fatal编程技术网

Magento-显示不是基础、小图片或拇指的图像

Magento-显示不是基础、小图片或拇指的图像,magento,Magento,我想知道是否有一种方法可以显示产品的图像,而不是基本的、小的或拇指的图像。我有几百个生成的产品没有选择,所以我想显示一个图像,即使没有选择。据我所知,您不应该尝试这种方法 最好的解决方案是在数据库上运行一个脚本,并为所有这些产品设置默认映像,而不使用任何映像 以下是脚本: # Brings all products with no standards images SELECT * FROM catalog_product_entity_varchar WHERE entity_type_i

我想知道是否有一种方法可以显示产品的图像,而不是基本的、小的或拇指的图像。我有几百个生成的产品没有选择,所以我想显示一个图像,即使没有选择。

据我所知,您不应该尝试这种方法

最好的解决方案是在数据库上运行一个脚本,并为所有这些产品设置默认映像,而不使用任何映像

以下是脚本:

# Brings all products with no standards images
SELECT * 
FROM catalog_product_entity_varchar 
WHERE entity_type_id = 4 
    AND attribute_id in (85,86,87) # base image = 85, small_image = 86, thumbnail = 87
    AND value = 'no_selection';

# update images
UPDATE catalog_product_entity_varchar t1
SET t1.`value` = (
    SELECT t2.`value` 
    FROM catalog_product_entity_media_gallery t2 
    WHERE t2.attribute_id = 88 AND t2.entity_id = t1.entity_id
    LIMIT 1)
WHERE t1.entity_type_id = 4 
    AND t1.attribute_id in (85,86,87) # base image = 85, small_image = 86, thumbnail = 87
    AND t1.`value` = 'no_selection';

干杯,

这实际上不是开箱即用的。据说mySQL改变了215个对象,但我有大约900个产品。