需要在magento中显示未找到的目录图像而不是占位符
我陷入了一个问题。我正在使用另一台服务器上载图像。让我先详细谈谈这个问题 当我从媒体文件夹中手动删除图像时,占位符图像现在显示出来 最初 目录/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/c/o/controlbar-white-small.jpg 手动删除图像后 catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/images/catalog/product/placeholder/image.jpg 我的要求是,我的存储仍应获取与删除前相同的图像Url,因为数据库中的图像路径仍然存在需要在magento中显示未找到的目录图像而不是占位符,magento,placeholder,Magento,Placeholder,我陷入了一个问题。我正在使用另一台服务器上载图像。让我先详细谈谈这个问题 当我从媒体文件夹中手动删除图像时,占位符图像现在显示出来 最初 目录/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/c/o/controlbar-white-small.jpg 手动删除图像后 catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/images/catalog/produc
请提供帮助。这是一种core magento行为,因此没有图像的产品将显示占位符而不是损坏的图像,因此除非您在app/code/core/Mage/Catalog/Model/product/image.php中对core image/helper进行大量更改,否则唯一的其他方法就是更改占位符 你有没有想过仅仅改变占位符图像 在管理中,在系统>配置>目录>产品图像占位符下,您可以上载新文件 核心配置数据表
我已经解决了我的问题。我指的是解决办法 转到OnePica\u ImageCDN-1.0.9\OnePica\ImageCDN\Model\Adapter\Amazons3.php 替换这个 公共函数getUrl($filename) { 借 公共函数getUrl($filename) {
是的,这是Magento的默认功能,但由于使用另一台服务器进行图像上载,我希望它独立于Magento媒体中的图像文件。我遵循了您建议的相同概念,并在3天内完成了一个非常简单的修复。
$type = Mage::app()->getStore()->isCurrentlySecure() ? 'url_base_secure' : 'url_base';
$base_url = Mage::getStoreConfig('imagecdn/amazons3/' . $type);
$filename = $base_url . $this->getRelative($filename);
return str_replace('\\', '/', $filename);
}
$type = Mage::app()->getStore()->isCurrentlySecure() ? 'url_base_secure' : 'url_base';
$base_url = Mage::getStoreConfig('imagecdn/amazons3/' . $type);
$product = Mage::registry('current_product');
$productId = $product->getId();
$resource = Mage::getSingleton('core/resource')->getConnection('core_write');
$imageName = $resource->fetchOne("select value from catalog_product_entity_varchar where attribute_id=86 && entity_id = ".$productId);
$filename = $base_url . $this->getRelative($filename);
$filename = substr($filename, 0, -22);
$filename = $filename.$imageName;
return str_replace('\\', '/', $filename);
}