$layer = Mage::getSingleton('catalog/layer');
$attributes =$layer->getFilterableAttributes();
$w_meta = "";
$w_arr =array();
if(Mage::registry('current_category')){
$w_arr[] =str_replace( '&', 'And',htmlspecialchars_decode(Mage::registry('current_category')->getName()));
}
foreach($attributes as$attribute){
$w_value =Mage::app()->getRequest()->getParam($attribute->getAttributeCode());
if(!empty($w_value)){
if($attribute->getAttributeCode()== 'price'){
$w_arr[] =$attribute->getAttributeCode().':'.str_replace(',','-',$w_value);
}else{
$w_arr[] =$attribute->getAttributeCode().':'.$attribute->getFrontend()->getOption($w_value);
}
}
}
$w_meta = implode(',' ,$w_arr);
$w_meta =str_replace('cat:','',$w_meta);
$this->_data['description'] = str_replace('&', 'And', htmlspecialchars_decode($w_meta));
$attributes =$layer->getFilterableAttributes();
$w_meta = "";
$w_meta = implode(',' ,$w_arr);
本文介绍了一个 Magento 应用程序中如何通过获取当前类别的名称和过滤器属性值来生成描述性的元数据。具体实现涉及使用 Mage 单例模式获取商品分类层对象,并从中提取可过滤的属性。
320

被折叠的 条评论
为什么被折叠?



