小编Cha*_*had的帖子

获取magento中所有产品属性的数组

我想不出来了!

我试图在list.phtml页面上将产品属性列表放入一个数组中.我尝试了一切.我见过很多使用的解决方案

$attributes = $product->getAttributes();
Run Code Online (Sandbox Code Playgroud)

但我不能让它工作,它只是打开一个空白页面.任何帮助将不胜感激,到目前为止我花了几个小时和几个小时......

我使用的是Magento 1.4.2.0版

更新:这正是我想要做的:

$neededAttributes = Mage::helper('mymodule')->getNeededAttributes();
$attributes = $product->getAttributes();
foreach ($attributes as $attribute) {
   if(in_array($attribute->getAttributeCode(), $neededAttributes)) { 
      $attributename = $attribute->getAttributeCode();
  echo $attributename;
   }
 }
Run Code Online (Sandbox Code Playgroud)

这是在design/adminhtml/default/default/catalog/product/helper /中的gallery.phtml文件中

出于某种原因,我无法获取getAttributeCode函数来返回任何内容.

php zend-framework magento magento-1.4

13
推荐指数
3
解决办法
5万
查看次数

Magento从filter.phtml获取属性代码

我试图从filter.phtml模板文件中获取属性代码.有没有人有任何想法如何做到这一点?

php magento

4
推荐指数
1
解决办法
1万
查看次数

标签 统计

magento ×2

php ×2

magento-1.4 ×1

zend-framework ×1