【问题标题】:Add New Image Attribute in Magento backend and Get all images of that new image attribute在 Magento 后端添加新图像属性并获取该新图像属性的所有图像
【发布时间】:2014-01-07 06:26:41
【问题描述】:

我通过使用 catalog=>attributes=>manage 属性创建新属性,在 magento admin 中添加了新的图像属性,并且新属性显示在 admin 中。

但问题是我怎样才能得到这个属性的所有图像。?

我添加了 Pos 图像属性。现在我想要使用编码的这个属性的所有图像。请帮助

【问题讨论】:

  • 获取此属性的所有图像?表示特定产品?
  • 是的,我想获取特定产品的图像。我想获取 baseimage、smallimage、thumbnail、posimage。
  • 是的,谢谢老兄的帮助。新的图像属性图像来自产品数据。这解决了我的问题。非常感谢
  • 如果您觉得我的回答有帮助,请接受我的回答。
  • 如果您觉得我的回答有帮助,请接受我的回答

标签: magento magento-1.7 magento-1.6


【解决方案1】:
 <?$_images = Mage::getModel('catalog/product')->load($_product->getId())->getMediaGalleryImages();?>
    <?if($_images){?>           
       <?$i=0; foreach($_images as $_image){ $i++;?>
          <a href="#"><img src="<?=$this->helper('catalog/image')->init($_product, 'thumbnail', $_image->getFile())->resize(200, 130); ?>" width="200" height="130" alt="<?=$this->htmlEscape($_image->getLabel());?>" title="<?=$this->htmlEscape($_image->getLabel());?>" /></a>              
           <a href="#"><img src="<?=$this->helper('catalog/image')->init($_product, 'small_image', $_image->getFile())->resize(200, 130); ?>" width="200" height="130" alt="<?=$this->htmlEscape($_image->getLabel());?>" title="<?=$this->htmlEscape($_image->getLabel());?>" /></a>               
       <?}?>
    <?}?>

您可以使用此代码获取图像,如果缩略图则更改标签以获取不同的图像,然后使用缩略图

【讨论】:

  • 我们能否使用特定产品的编码检查图像属性类型是否为缩略图、图像、pos 图像
  • 你可以签入 $_product 对象,只需编写 $_product->getData() 即可获取有关特定产品的所有信息
  • 你能告诉我如何创建一个主题 og magento.from 我必须从哪里开始。我知道magento的基本结构。在此先感谢
  • 如果您有不同的问题,请单独提问
猜你喜欢
  • 2016-12-24
  • 1970-01-01
  • 1970-01-01
  • 2013-03-01
  • 2022-01-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-02-17
相关资源
最近更新 更多