2

I have override customer resource module in custom module. Like : Core_Mage_Model_Resource_Customer Override this module but not succeed. I have follow these steps : Here is config.xml

<?xml version="1.0"?>
<config>
    <modules>
       <Abc_CustomizeCustomers>
       <version>0.1.0</version>
       </Abc_CustomizeCustomers>
    </modules>
    <global>
       <customer_re>
          <rewrite> 
            <customer_resource> Abc_CustomizeCustomers_Model_Resource_Customer</customer_resource>
          </rewrite>
       </customer_re>
    </global>
</config> 

Here is Customer.php

 <?php
    class Abc_CustomizeCustomers_Model_Resource_Customer extends 
      Mage_Eav_Model_Entity_Abstract
     {
         protected function _beforeSave(Varien_Object $customer)
         {
             Mage::log("checkCustomer", null, 'appServer.log');
         } 
     }

But when save customer. log file is not create. I want to override _beforeSave Function.

Please anyone suggest me how to fix this.

1 Answer 1

2

You have to add models node and follow below code

<?xml version="1.0"?>
<config>
    <modules>
       <Abc_CustomizeCustomers>
       <version>0.1.0</version>
       </Abc_CustomizeCustomers>
    </modules>
    <global>
       <models>
          <customer_resource>
            <rewrite> 
              <customer>Abc_CustomizeCustomers_Model_Resource_Customer</customer>
            </rewrite>
          </customer_resource>
       </models>
    </global>
</config>

And file will be extends Mage_Customer_Model_Resource_Customer

<?php
    class Abc_CustomizeCustomers_Model_Resource_Customer extends 
      Mage_Customer_Model_Resource_Customer
     {
         public function __construct()
         { echo "dsfsdfdsfsd"; exit;


         } 
     }

Second solution you can use event for that too customer_save_before

3
  • I am trying to these but not succeed. Nov 22, 2017 at 7:32
  • @RakeshPatidar it is tested code i checked it is working now i update the php file too Nov 22, 2017 at 7:36
  • @RakeshPatidar other option is use event customer_save_before Nov 22, 2017 at 7:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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