Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Event dispatch requests
 
MahendraDan
Member
 
Total Posts:  43
Joined:  2010-04-05
 

Hi All,

I am trying to override the core module ( Mage_Cron_Model_Observer) functionality (basically i want to change the dispatch method of this module)

For this perspective i have made the changes in to our created module config.xml in the following way.

<crontab>
                     
                        <
events>
                            <default>
                                <
observers>
                                    <
rewrite>
                                    <
cron_observer>
                                        <class>
ModelName/Observer</class>
                                        <
method>dispatch</method>
                                    </
cron_observer>
                                    </
rewrite>
                                </
observers>
                            </default>
                        </
events>
</
crontab>

But i goe the Fatal Error Like

Fatal errorCall to a member function () on a non-object in app\code\core\Mage\Core\Model\App.php on line 1207

I am following the above approach because, currently magento cron does’t support for parameterised calling using below kind statements

Currently supported -

<shedule_job>
                   <
schedule><cron_expr>* * * * *</cron_expr></schedule>
                   <
run>
                    <
model>Module/observer::Method</model>
                   </
run>
        </
shedule_job>

I want Like this

<shedule_job>
                   <
schedule><cron_expr>* * * * *</cron_expr></schedule>
                   <
run>
                    <
model>Module/observer::Method('Parameter2''Parameter2')</model>
                   </
run>
        </
shedule_job>

Please help me out i figure out this kind of issue

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
Chielus
Jr. Member
 
Total Posts:  9
Joined:  2010-07-05
 
WDCA - 26 January 2010 05:21 PM

The reward points extension for Magento called Sweet Tooth does a heavy rewrite of the customer model in order to monitor the new customer create event.  I wish we didn’t have to do it like that, but when we were developing it originally I couldn’t find the event being dispatched in the records.  After playing around with the save_after and save_before dynamic events, we ended up just rewriting the entire customer model. 

Now, in Sweet Tooth 1.3 we’ve programmed in a dispatch event for new customer creation so that extensions to Sweet Tooth, or any other modules that rely on Sweet Tooth functionality, can utilize the event and react as needed. The event code is “rewards_new_customer_create”.

Also, it’s important to note the difference between new customer creation and customer registration events.  Customer registration can only occur in the frontend, and for that we would do a postdispatch or predispatch dynamic event reaction, however the ‘new customer’ even would react to the creation of a customer no matter where it’s done and no matter how it’s done.

Is there a ‘new customer’ event dispatched for any version of Magento yet so we don’t have to keep our own?  If not, I’d like to request that it be considered.

I second this. Having an event that triggers when a new customer has been created (in the frontend or backend) could be very useful

I need it for my extension too

The same with a new product (backend). we do have some events when a product has been saved, but not when a new product has been created

Or am I missing some events?

 
Magento Community Magento Community
Magento Community
Magento Community
 
ChrisLevy
Jr. Member
 
Avatar
Total Posts:  3
Joined:  2010-03-08
 

Hi there,

I would very much like to see a _beforeLoad() function in Mage_Core_Model_Abstract, and for it to have

Mage::dispatchEvent(’model_load_before’, array(’object’=>$this));
Mage::dispatchEvent($this->_eventPrefix.’_load_before’, $this->_getEventData());

Thanks very much

Lev

 
Magento Community Magento Community
Magento Community
Magento Community
 
mage5
Jr. Member
 
Avatar
Total Posts:  12
Joined:  2008-07-30
Trivandrum
 

I also need an event when Administrator logout

 
Magento Community Magento Community
Magento Community
Magento Community
 
Magestore
Mentor
 
Avatar
Total Posts:  1015
Joined:  2009-08-07
Viet Nam
 

Thanks for sharing the event list. It helps me too much.
I hope Magento core team will input more event in the next release.

 
Magento Community Magento Community
Magento Community
Magento Community
 
brucecaine
Jr. Member
 
Total Posts:  15
Joined:  2010-10-08
 

Will these effects be elicited even during product meaning process? say, will ‘catalog_product_save_after’ be raised later on importation the production using bulk import functionality?

 
Magento Community Magento Community
Magento Community
Magento Community
 
ShopGuy
Guru
 
Total Posts:  462
Joined:  2008-09-07
 

A hook right after a transactional email is sent would be nice in order to log all emails that magento sends.

 
Magento Community Magento Community
Magento Community
Magento Community
 
norbertwarne
Jr. Member
 
Total Posts:  15
Joined:  2010-10-13
 

Will these effects be produced even during product meaning process? say, will ‘catalog_product_save_after’ be raised after importing the product using bulk meaning functionality?

 
Magento Community Magento Community
Magento Community
Magento Community
 
darylnelson
Jr. Member
 
Total Posts:  15
Joined:  2010-10-23
 

I want an still all time a “transactional email” is sent out.  At least the newly order and order modify e-mails.

 
Magento Community Magento Community
Magento Community
Magento Community
 
decoryourbody
Jr. Member
 
Total Posts:  3
Joined:  2010-10-25
 

How do I create my own event?

I want to do something similar to cron.php, but I don’t know how to initialise Mage class before calling Mage::dispatchEvent(’my_event’);

Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
lakirarodricks
Jr. Member
 
Total Posts:  7
Joined:  2010-10-28
 

If these events occur during the process of importing the same products? to say, catalog_product_save_after raised after the product is imported with the import function block

 
Magento Community Magento Community
Magento Community
Magento Community
 
kiminox
Jr. Member
 
Total Posts:  2
Joined:  2010-05-24
 

Hi,

After reading your posts, I tried to implement an observer to fire an event BEFORE the user login.
I explain:
I have a forum and blog, using another framework.
I want the visitor to log only once: blog, forum or eshop.
And then, he will be logged for other areas.
Example: I am browsing the forum and I login into the forum. Then, when I open the shop, I am already logged in. And same thing for the opposite way.
It works but just one problem: when I logged into the forum/blog and if I open the shop, I need to refresh the page to see that I am logged.
Actually, it’s the same behavior than the standard Magento logout process: if you click on the link “logout” of your Magento shop, you will still see that you are logged in. There’s a redirection/refresh to the homepage and then you see the message that you are logged out.
Here is my code:
app/code/community/Fanxiang/UC/etc/config.xml:

[...]
<events>
<
http_response_send_before>
    <
observers>
        <
UC>
            <
type>model</type>
            <class>
Fanxiang_UC_Helper_Data</class>
            <
method>ucSynlog</method>
        </
UC>
    </
observers>
</
http_response_send_before>
</
events>
[...]

and:
app/code/community/Fanxiang/UC/Helper/Data.php

class Fanxiang_UC_Helper_Data extends Mage_Core_Helper_Abstract
{
     
public function ucSynlog($observer){
        
if(!empty($_COOKIE['Example_auth'])){
            
list($Example_uid$Example_username) = explode("\t"uc_authcode($_COOKIE['Example_auth']'DECODE'));
            list(
$Example_uid$Example_username,$email)        =uc_get_user($Example_username);
            
$customer Mage::getModel('customer/customer')->setWebsiteId(Mage::app()->getStore()->getWebsiteId())->loadByEmail($email);
            
Mage::getSingleton('customer/session')->setCustomerAsLoggedIn($customer);
        
else {
          Mage
::getSingleton('customer/session')->logout();
        
}
        Mage
::log(time(), null"logfile.log"); 
     
}
}

PB: I’d like to avoid to refresh the page to see that I am logged in.
Any idea or help is welcomed!

Yoong

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ben Marks
Moderator
 
Avatar
Total Posts:  452
Joined:  2008-10-09
Isle of Palms, SC
 

For all who are observing this topic: it goes without saying that in your custom module you can extend core Magento methods and dispatch your own event. Many know this and are already doing this, but for those of you who are new to Magento, this is easy enough to accomplish.

Ben

 
Magento Community Magento Community
Magento Community
Magento Community
 
Reindl Bernd
Jr. Member
 
Total Posts:  1
Joined:  2010-08-19
 

Hello Community,

i have tryed to use the customer_save_before Event to validate the Tax/VAT (Ust.-ID in German) via a SOAP call to hte MIAS-Database.

if it is valid the observerfunction returns nothing and the save proccess continues

if it is not valid an Exception was thrown with a Message that the validation is falied.

This is runing perfect at the frontend but in the backend it fails because the app/code/core/adminhtml/controlers/CustomControler.php saves the data in row 262 ("Mage::getSingleton(’adminhtml/session’)->setCustomerData($data);").

After the redirect the function editAction was called and in row 108 a loop adds the addresses to the customer object. But this fails because the customer allready have the address with the id.

Is there an other way to stop the save proccess after validation?

My code

class TM_UIDCheck_Model_Observer
{
    
public function customerSaveBeforeEvent($observer{        
        $UIDCheckHelper 
Mage::helper('UIDCheck');        
        
$addressHelper Mage::helper('customer/address');
        
$event $observer->getEvent();
        
$customer $event->getCustomer();
        
        if(
$addressHelper->getConfig('taxvat_validate') == && $addressHelper->getConfig('taxvat_show') == 'req' && !$customer->getData('taxvat'))
            throw new 
Exception($UIDCheckHelper->__('Please enter a VAT-Number!'));
            
        if(
$addressHelper->getConfig('taxvat_validate') == && ($addressHelper->getConfig('taxvat_show') == 'req' || ($addressHelper->getConfig('taxvat_show') == 'opt' && $customer->getData('taxvat'))))
        
{
            
try
            
{
                $taxvat 
$customer->getData('taxvat');                
                
$countryCode substr($taxvat02);
                
$vatNumber substr($taxvat2);
                
                
$validator = new Zend_Soap_Client("http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl", array('encoding' => 'UTF-8'));
                
                
$result $validator->checkVat(array('countryCode' => $countryCode'vatNumber' => $vatNumber));
                if(
$result->valid)
                    return;
            
}
            
catch(Exception $e{ }            
            
throw new Exception($UIDCheckHelper->__("'%s' is not a valid VAT-Number!"$customer->getData('taxvat')));        
        
}
    }

}

PS: Excuse my bad English smile

best regards

Reindl Bernd

 
Magento Community Magento Community
Magento Community
Magento Community
 
danshields
Member
 
Total Posts:  32
Joined:  2009-03-11
 

It would be nice to have hooks into after each step of the checkout process. Right now there is only one after the shipping method save and order complete but there should be one for after billing, shipping and payment.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top