Magento getCollection() Returns False – How to Fix

databasemagento-1.7magento-1.8magento-1.9

class Mage_Customer_Model_Designs file

function _construct()
{
  $this->_init('customer_designs/customer');
}

class Mage_Customer_Model_Resource_Designs file

protected function _construct()
{
  $this->_init('customer_designs/customer','d_id');
}

class Mage_Customer_Model_Resource_Designs_Collection file

protected function _construct()
{
  $this->_init('customer_designs/customer');
}

class Mage_Customer_Block_Account_Dashboard_Designs file

function get_my_designs()
{
 return $collection = Mage::getModel('customer/designs')->getCollection();
}

Table Name: customer_designs, Table Prefix: djc

These are all my codes. My Blog file returns bool(false). I just replaced existing code. I don't know how these codes are all codes working. Kindly help me to get out of this issue.

Best Answer

Vivek Aasaithambi,I did not understand why you have doing this type of code.

Issue 1: Why you have write your class at Core class it too wrong process.If you have create a new module then you should create custom module with database. see at http://www.amitbera.com/create-an-magento-extension-with-custom-database-table/

Issue 2:

If you have write this type code.then there are lot of issues.

model construct is to wrong

class Mage_Customer_Model_Designs file

function _construct()
{
  $this->_init('customer/designs');
}

class Mage_Customer_Model_Resource_Designs file

protected function _construct()
{
  $this->_init('customer/designs','d_id');
}

class Mage_Customer_Model_Resource_Designs_Collection file

protected function _construct()
{
  $this->_init('customer/designs');
}

I Guess that there must be lot of issue in your code

I suggest you please use issue 1 as good solution.