求教!Magento如何在模版中进行属性集调用?

xiaohe741 2012-07-26 04:35:56
求教!如何在模版中进行属性集调用?




举例好比~~有两个属性集A,B
A 里有 a-1,a-2属性
B 里有 b-1,b-2属性
A 和 B 这两个属性集里都有params这个自定义的属性组,并分别包含 a-1,a-2 和 b-1,b-2

我想在产品页里判断该产品用的是哪个属性集~~然后调用自定义属性组(params)里的所有属性进行循环输出
请问该如何实现~~要修改那些地方

...全文
184 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
wuchangqian007 2012-07-30
  • 打赏
  • 举报
回复
 /**
* Retrieve product attributes
*
* if $groupId is null - retrieve all product attributes
*
* @param int $groupId
* @return array
*/
public function getAttributes($groupId = null, $skipSuper=false)
{
$productAttributes = $this->getTypeInstance(true)->getEditableAttributes($this);
if ($groupId) {
$attributes = array();
foreach ($productAttributes as $attribute) {
if ($attribute->isInGroup($this->getAttributeSetId(), $groupId)) {
$attributes[] = $attribute;
}
}
} else {
$attributes = $productAttributes;
}

return $attributes;
}
xiaohe741 2012-07-30
  • 打赏
  • 举报
回复
能说的在细些吗?

20,359

社区成员

发帖
与我相关
我的任务
社区描述
“超文本预处理器”,是在服务器端执行的脚本语言,尤其适用于Web开发并可嵌入HTML中。PHP语法利用了C、Java和Perl,该语言的主要目标是允许web开发人员快速编写动态网页。
phpphpstorm 技术论坛(原bbs)
社区管理员
  • 开源资源社区
  • phpstory
  • xuzuning
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧