gpt4 book ai didi

magento - Magento 中的 Collection::addAttributeToSelect() 未定义方法

转载 作者:行者123 更新时间:2023-12-02 02:24:16 25 4
gpt4 key购买 nike

Fatal error: Call to undefined method Desbest_Showdown_Model_Mysql4_Votes_Collection::addAttributeToSelect() in /home/desbest/public_html/clients/magentofull/app/code/local/Desbest/Showdown/controllers/IndexController.php on line 19

IndexController.php

public function voteAction(){
$shake = Mage::getModel('showdown/votes')
->getCollection()
->addAttributeToSelect('*')
;
}

==============

code/local/Desbest/Showdown/Model/Mysql4/Votes/Collection.php

<?php
class Desbest_Showdown_Model_Mysql4_Votes_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
{
public function _construct()
{
parent::_construct();
$this->_init('showdown/votes');
}
}

最佳答案

addAttributeToSelect() 仅用于 EAV 样式模型集合(产品、客户等)

对于其他模型,您可以使用 Mage_Core_Model_Resource_Db_Collection_Abstract::addFieldToSelect() 方法。

关于magento - Magento 中的 Collection::addAttributeToSelect() 未定义方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11477729/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com