Rua*_*ova 4 attributes magento
我需要知道哪些属性"在产品列表中使用"选中为YES,但没有找到任何函数,例如$ attribute-> getIsVisibleOnFront()
事实上,我不知道如何从属性的"前端属性"中获取选项值(在快速搜索中使用,在高级搜索中使用,...)
我的代码是这样的:
<?php $attributes = $_product->getAttributes();
foreach ($attributes as $attribute) {
if ($attribute->getIsUsedInProductListing()) {
echo $attribute->getStoreLabel();
}
}
?>
Run Code Online (Sandbox Code Playgroud)
getIsUsedInProductListing()不存在;-)
谢谢...
是的,这很容易做到.
$product = Mage::getModel('catalog/product')->load($productId); // Or, use your product
$attributes = $product->getTypeInstance(true)->getSetAttributes($product);
foreach ($attributes as $attribute){
var_dump($attribute); // You will be able to see all of the attribute settings here.
if ($attribute->getUsedInProductListing()) {
// Do cool things here.
}
if ($attribute->getIsHtmlAllowedOnFront()) {
// Do cool things here.
}
if ($attribute->getIsVisibleInAdvancedSearch()) {
// Do cool things here.
}
if ($attribute->getUsedForSortBy()) {
// Do cool things here.
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2123 次 |
| 最近记录: |