我不希望使用foreach通过多行的数组循环,因为我只上只显示筹划一个行和使用的变量.我在网上找不到这方面的信息.
什么行不通
$param = $this->getRequest()->getParam('manufacturer');
$extrabrand = Mage::getModel('brands/brands')->getCollection();
$extrabrand->addFieldToFilter('attributelabelid', $param);
//$extrabrand->setAttributelabelid($param);
$extrabrand->load();
Run Code Online (Sandbox Code Playgroud)
致命错误:在第20行的/home/desbest/public_html/clients/magentofull/app/design/frontend/default/default/template/Desbest_Brands/brand_info.phtml中调用未定义的方法Desbest_Brands_Model_Mysql4_Brands_Collection :: getDescription()
此外,没有EAV.
Ala*_*orm 10
在没有看到代码brand_info.phtml的情况下很难说出问题是什么,但我的猜测是你正在使用该集合,$extrabrand就好像它是一个模型.试试这个
//get the parameter from the request
$param = $this->getRequest()->getParam('manufacturer');
//instantiate the brand/brand model, and use
//its `getCollection` method to return a collection
//object
$collection = Mage::getModel('brands/brands')->getCollection();
//add the paramater as a filter
$collection->addFieldToFilter('attributelabelid', $param);
//get the first item of the collection (load will be called automatically)
$extrabrand = $collection->getFirstItem();
//look at the data in the first item
var_dump($extrabrand->getData());
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9549 次 |
| 最近记录: |