Note that there are some explanatory texts on larger screens.

plurals
  1. POMagento custom registration success message after redirect to dashboard
    primarykey
    data
    text
    <p>I need to extend the custom success message after the customer registration. Now after registration the user is redirected to the dashboard and the standard success message is shown: "Thank you for registering with...".</p> <p>I need that this message changes base on the customer group attribute. I read on-line but didn't find a working solution... but I think I'm making it in the wrong way. I started from here: <a href="http://mydons.com/simple-example-using-magento-event-observer/" rel="nofollow">http://mydons.com/simple-example-using-magento-event-observer/</a> to make a custom observer on the customer_register_success event, so I made the module xml named Bbox_Regmess.xml in app/etc/modules:</p> <pre><code>&lt;config&gt; &lt;modules&gt; &lt;Bbox_Regmess&gt; &lt;active&gt;true&lt;/active&gt; &lt;codePool&gt;local&lt;/codePool&gt; &lt;/Bbox_Regmess&gt; &lt;/modules&gt; &lt;/config&gt; </code></pre> <p>Than I made the app/code/local/Bbox/Regmess/etc and app/code/local/Bbox/Regmess/Model folders with inside the config.xml:</p> <pre><code>&lt;config&gt; &lt;modules&gt; &lt;Bbox_Regmess&gt; &lt;version&gt;0.1.0&lt;/version&gt; &lt;/Bbox_Regmess&gt; &lt;/modules&gt; &lt;frontend&gt; &lt;events&gt; &lt;customer_register_success&gt; &lt;observers&gt; &lt;Bbox_Regmess_Model_Observer&gt; &lt;type&gt;singleton&lt;/type&gt; &lt;class&gt;Bbox_Regmess_Model_Observer&lt;/class&gt; &lt;method&gt;Customregmess&lt;/method&gt; &lt;/Bbox_Regmess_Model_Observer&gt; &lt;/observers&gt; &lt;/customer_register_success&gt; &lt;/events&gt; &lt;/frontend&gt; &lt;/config&gt; </code></pre> <p>And the Observer.php that is just a first try to see if I'm able to add a custom success message:</p> <pre><code>&lt;?php class Bbox_Regmess_Model_Observer { public function Customregmess($observer) { $event = $observer-&gt;getEvent(); //Fetches the current event $customer = $event-&gt;getCustomer(); $eventmsg = "Current Event Triggered : &lt;I&gt;" . $event-&gt;getName() . "&lt;/I&gt;&lt;br/&gt; Currently Added Product : &lt;I&gt; " . $customer-&gt;getCustomerName()."&lt;/I&gt;"; //Adds Custom message to shopping cart Mage::getSingleton('customer/session')-&gt;addSuccess($eventmsg); } } ?&gt; </code></pre> <p>Now if a user registers to the shop, he get the standard registration message and there is not the custom $eventmsg</p> <p>What I'm making wrong? There is another way to to that? Thanks <br> <br></p> <p><strong>UPDATE:<br></strong> looking deeper I found out the default success message is defined in the app/code/core/Mage/Customer/controllers/AccountController.php at line 390 (just after the line 334 where there is the definition of customer_register_success event I'm trying to work with).<br> at line 390 there is the _welcomeCustomer function that is in charge of setting the success message, send confirmation email and set the success redirect url:</p> <pre><code>protected function _welcomeCustomer(Mage_Customer_Model_Customer $customer, $isJustConfirmed = false) { $this-&gt;_getSession()-&gt;addSuccess( $this-&gt;__('Thank you for registering with %s.', Mage::app()-&gt;getStore()-&gt;getFrontendName()) ); $customer-&gt;sendNewAccountEmail( $isJustConfirmed ? 'confirmed' : 'registered', '', Mage::app()-&gt;getStore()-&gt;getId() ); $successUrl = Mage::getUrl('*/*/index', array('_secure'=&gt;true)); if ($this-&gt;_getSession()-&gt;getBeforeAuthUrl()) { $successUrl = $this-&gt;_getSession()-&gt;getBeforeAuthUrl(true); } return $successUrl; } </code></pre> <p>Is there any chance to extend this function so I can manage multiple success message base on the customer group?<br> I've look for some resource about it, but I didn't find anything usefull</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload