Magento 如何检查自定义图像属性的可用性
我知道这个问题被问了很多次,但我在自定义图像属性中遇到了一些问题我使用magento admin创建了新的自定义图像(image180)属性&使用此代码在前端获取图像&此代码正常工作&显示图像如何更正此问题&提前感谢Magento 如何检查自定义图像属性的可用性,magento,Magento,我知道这个问题被问了很多次,但我在自定义图像属性中遇到了一些问题我使用magento admin创建了新的自定义图像(image180)属性&使用此代码在前端获取图像&此代码正常工作&显示图像如何更正此问题&提前感谢 <div class="rotate"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'image180'); ?>"></div>
<div class="rotate"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'image180'); ?>"></div>
helper('catalog/image')->init($_product,'image180');?>">
但我必须检查此图像是否可用,然后运行代码如果不可用不要运行此代码,因为如果此属性不可用fir特定产品,则产品页面未加载并显示错误&我使用此代码检查自定义图像的可用性,但不工作出了什么问题
<?php if ($_product->getimage180()):?>
<div class="rotate"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'image180'); ?>"></div>
<?php endif;?>
helper('catalog/image')->init($_product,'image180');?>“>
请您试试这个
getImage180()):?>
helper('catalog/image')->init($_product,'image180');?>“>你可以试试
if($\u product->getData('image180')!=null&&$\u product>getData('image180')!='no\u selection')
而不是if($\u product->getimage180())
如果您使用$\u product->getimage180()
,那么它也是无效的
它应该是$\u product->getImage180()