Rewrite core model

1382 단어 rewrite
example: we will rewrite Mage_Newsletter_Model_Subscriber in order to disable send success subscriber and send unsubscription mail function :
in config.xml:
   <global>
         <models>
         	<mynewsletter>
				<class>Bysoft_Mynewsletter_Model</class>
				<resourceModel>mynewsletter_mysql4</resourceModel>
	  		</mynewsletter>
            <newsletter>
                <rewrite>
                    <subscriber>Bysoft_Mynewsletter_Model_Subscriber</subscriber>
                </rewrite>
            </newsletter>
        </models>
    </global>

 create custom model class to rewrite core model class:
<?php
class Bysoft_Mynewsletter_Model_Subscriber extends Mage_Newsletter_Model_Subscriber
{
	/**
	 * Sends out confirmation success email
	 *
	 * @return Mage_Newsletter_Model_Subscriber
	 */
	public function sendConfirmationSuccessEmail()
	{
		return $this;
	}
	/**
	 * Sends out unsubsciption email
	 *
	 * @return Mage_Newsletter_Model_Subscriber
	 */
	public function sendUnsubscriptionEmail()
	{
		return $this;
	}
}

좋은 웹페이지 즐겨찾기