0

hei everyone, i have module which use observer event sales_model_service_quote_submit_after , its work well so far

But, when i create other module with same observer event it not work, magento just fire observer of my first module. My observer of my second module its not fire

its my first config of observer :

 <events>
      <sales_model_service_quote_submit_after>
        <observers>
          <sales_model_service_quote_submit_after>
            <type>singleton</type>
            <class>Sprint_Migs_Model_Observer</class>
            <method>saveSiteID</method>
          </sales_model_service_quote_submit_after>
        </observers>
      </sales_model_service_quote_submit_after>
</events>

its my second config of observer :

 <events>
      <sales_model_service_quote_submit_after>
        <observers>
          <sales_model_service_quote_submit_after>
            <type>singleton</type>
            <class>Sprint_BcaKlikPay_Model_Observer</class>
            <method>saveData</method>
          </sales_model_service_quote_submit_after>
        </observers>
      </sales_model_service_quote_submit_after>
    </events>

Its my observer of my first module

<?php

class Sprint_Migs_Model_Observer{

public function saveSiteID($observer){
    $post = Mage::app()->getFrontController()->getRequest()->getPost();
    if(isset($post['payment']['method'])){
        if ($post['payment']['method'] == "migs"){
            $merchantTransactionID  = $observer->getEvent()->getOrder()->getIncrementId();
            $siteId                 = $post['payment']['site_id'];
            $transactionType        = Mage::getStoreConfig('payment/migs/transactionType');
            $currency               = 'IDR';
            $amount                 = Mage::helper('migs')->getTotalPrice();

            $data       = array("merchantTransactionID" => $merchantTransactionID,"siteId" => $siteId,"transactionType" => $transactionType,"currency" => $currency,"amount" => $amount); 
            Mage::helper('migs')->insertMigsData($data);
        }
    }
}

}

Its my observer of my second module that not working :

<?php

class Sprint_BcaKlikPay_Model_Observer{

public function saveData($observer){
    $post = Mage::app()->getFrontController()->getRequest()->getPost();
    if(isset($post['payment']['method'])){
        if ($post['payment']['method'] == "bcaklikpay"){
            $transactionNo  = $observer->getEvent()->getOrder()->getIncrementId();
            $tenor          = $post['payment']['bca_tenor'];
            $payType        = Mage::helper('bcaklikpay')->getPayType($tenor);   

            $data       = array("transactionNo" => $transactionNo,"payType" => $payType,"tenor" => $tenor); 
            Mage::helper('bcaklikpay')->insertData($data);
        }
    }
}

}

0

You made a mistake in your observer definition:

<events>
  <sales_model_service_quote_submit_after>      <--- event name
    <observers>
      <sales_model_service_quote_submit_after>  <--- unique identifier for the OBSERVER

The observer identifier can be anything, as long as it is unique. As soon as you use the same identifier twice for one event, it overrides the previous observer. Usually you would use your module name as identifier to avoid conflicts with other modules.

0

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.