I have made my Magento Model :
<?php
class Kiwi_SliderBoard_Model_Resource_Slider_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
{
protected function _construct()
{
$this->_init("sliderboard/slider");
}
}
Whene i try to use it on my block :
class Kiwi_SliderBoard_Block_Slider extends Mage_Catalog_Block_Product_Abstract {
public function getSlider ()
{
$slider= Mage::getModel('sliderboard/slider')
->getCollection()
->addAttributeToFilter('status', array('eq' => 1));
return $slider;
}
}
I got this Error !
Fatal error: Call to undefined method Kiwi_SliderBoard_Model_Resource_Slider_Collection::addAttributeToFilter() in C:\wamp\www\ce_1.6.2.0\app\code\local\Kiwi\SliderBoard\Block\Slider.php on line 8
Can you help !
Thanks
addAttributeToFilter();
is only used for the EAV Collections like products, customers, etc.
for all the other collections just use :
addFieldToFilter();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With