2

I Create a new table with the name of "directory_country_city",then i config the new table in my config.xml its placed in "FederalLawyer/app/code/local/Federallawyer/Customer/config.xml"

The code in config.xml
----------------------
<config>
    <modules>
        <Federallawyer_Customer>
            <version>1.1.5</version>
        </Federallawyer_Customer>
    </modules>
    <global>
        <blocks>
            <adminhtml>
                <rewrite>
                    <customer_edit_tabs>Federallawyer_Customer_Block_Adminhtml_Customer_Edit_Tabs</customer_edit_tabs>
                    <customer_grid>Federallawyer_Customer_Block_Adminhtml_Customer_Grid</customer_grid>
                    <customer_edit_tab_account>Federallawyer_Customer_Block_Adminhtml_Customer_Edit_Tab_Account</customer_edit_tab_account>
                </rewrite>
            </adminhtml>
            <customer>
                <rewrite>
                    <form_register>Federallawyer_Customer_Block_Form_Register</form_register>
                    <account_navigation>Federallawyer_Customer_Block_Customer_Account_Navigation</account_navigation>
                    <address_book>Federallawyer_Customer_Block_Address_Book</address_book>
                    <form_edit>Federallawyer_Customer_Block_Form_Edit</form_edit>
                </rewrite>
            </customer>

            <federallawyer_customer>
                <class>Federallawyer_Customer_Block</class>
            </federallawyer_customer>

        </blocks>
        <helpers>
            <customer>
                <rewrite>
                    <data>Federallawyer_Customer_Helper_Data</data>
                </rewrite>
            </customer>
        </helpers>

        <models>
            <customer>
                <rewrite>
                    <customer>Federallawyer_Customer_Model_Customer</customer>
                </rewrite>
            </customer>
            <customer>
                <class>Federallawyer_Customer_Model</class>
                <resourceModel>customer_resource</resourceModel>
            </customer>
            <customer_resource>
                <class>Federallawyer_Customer_Model_Resource</class>
                <entities>
                    <cities><table>directory_country_city</table></cities>
                </entities>
            </customer_resource>

        </models>

          <resources>
            <federallawyer_customer_setup>
                <setup>
                    <module>Federallawyer_Customer</module>
                    <class>Mage_Customer_Model_Resource_Setup</class>
                </setup>
            </federallawyer_customer_setup>
        </resources>

    </global>

    <frontend>
        <routers>
            <customer>
                <args>
                    <modules>
                        <federallawyer_customer before="Mage_Customer">Federallawyer_Customer</federallawyer_customer>
                    </modules>
                </args>
            </customer>
        </routers>
    </frontend>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <Federallawyer_Customer before="Mage_Adminhtml">Federallawyer_Customer_Adminhtml</Federallawyer_Customer>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>

    <frontend>
        <layout>
            <updates>
                <customer>
                    <file>federallawyer/customer.xml</file>
                </customer>
            </updates>
        </layout>
    </frontend>

    <adminhtml>
        <layout>
            <updates>
            <customer>
                <file>federallawyer/customer.xml</file>
            </customer>
        </updates>
        </layout>
    </adminhtml>
</config>

But it throw an error in admin end "Fatal error: Call to a member function addFieldToFilter() on a non-object "
1

I cannot understand why you have using

Model,resource model's, prefix identifier as customer. Also you have using

.....
    <global>
         <models>
.....
            <customer> <!-- Model Prefix identifier -->
                <class>Federallawyer_Customer_Model</class>
                <resourceModel>customer_resource</resourceModel>
            </customer>
            <customer_resource> <!-- Resource Model Prefix identifier -->
                <class>Federallawyer_Customer_Model_Resource</class>
                <entities>
                    <cities><table>directory_country_city</table></cities>
                </entities>
            </customer_resource>
....................
        </models>
  .......        
    </global>

Which is already element of Mage_Customer module

That make issue.You need to change to all this.

.....

    <global>
         <models>
.....
            <federallawyercustomer> <!-- change here -->
                <class>Federallawyer_Customer_Model</class>
                <resourceModel>federallawyercustomer_resource</resourceModel> <!-- change here -->
            </federallawyercustomer>
            <federallawyercustomer_resource> <!-- change here -->
                <class>Federallawyer_Customer_Model_Resource</class>
                <entities>
                    <cities><table>directory_country_city</table></cities>
                </entities>
            </federallawyercustomer_resource>
....................
        </models>
  .......        
    </global>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.