How to add custom notification in Magento - php

I have created a magento plugin and I need to add custom notification to magento admin just below the admin menu where the LATEST and CRITICAL error are shown.
I have also tried the steps from this link https://www.openstream.ch/developer-blog/adding-magento-admin-notifications-to-your-extension/. The custom notification are not shown still.
What I need is to display my custom error notification in admin section default just like how other notifications are displayed.
Can anyone tell me the steps to do that?

I was also looking for the same solution. I decided to check opensource repositories and i happen to come across a working version of the "Openstream" turorial you had mentioned.
all you have to do is:
download the files from here
drop the files in your Magento app folder
edit the config.xml file with your feed address/directory
flush Magento cache
Refresh page and you should see your feed.
Here's another extension with similar features: custom notification
i haven't tried this one...
I hope one of these help you!

There is a singleton for that!
... } catch (Exception $e) {
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
}
add the exception or whatever you want. This doesn't need to be in a try catch.

Set Your Message.
Mage::getSingleton("core/session")->addSuccess("Add success message");
Mage::getSingleton("core/session")->addError(" Add error message");
Mage::getSingleton("core/session")->addNotice("Add notification message");
Display Your Message. (Optional If use custom Extension Or not Defined)
<?php echo $this->getChildHtml('global_messages'); ?>
3.Define Block in Layout. (Optional If use custom Extension Or not Defined)
<block type="core/messages" name="global_messages" as="global_messages"/>

Related

wordpress plugin custom activation message

i created a wordpress plugin .when i activated the plugin i got "plugin activated" flash msg. actually i want to customize this message to "connect to my-plugin" and also provide a link to this plugin settings page. i try
add_action( 'admin_notices', 'your_custom_function' );
function your_custom_function() {
echo "connect to my-plugin";
if( $error ) {
// Put everything here
}
}
results connect to my-plugin msg shown on every page in admin panel.i just want to show my custom msg only at the time of activation on plugins page only
also i got an error
The plugin generated 2 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.
I guess the one filter hook you are looking for is plugin_action_links_(plugin_file_name) which allows you to add custom links to your plugin entry on the Plugins page.
To display an activation message, see this tutorial.
You could have found these two with some research on your own.

unable to add custom options with existing products in magento

I am working on a magento site. I can't edit or add custom options of my existing products. No error message is showing, it's showing "product has been saved successfully" But when I create a new product and try to add options to them, it's working fine also can edit options.
Can anybody help?
Try to enable developer mode from index.php and check it.
if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
Mage::setIsDeveloperMode(true);
}
replace with
Mage::setIsDeveloperMode(true);
remove if condition only. And try to save product and check it what error display.

WP Jetpack publicize insert default text(s)

How can I place a default text (hashtag) in the Custom Message?
The textarea is (located in line 643) under jetpack/modules/publicize/ui.php
I tried to put the text in front of $title in various ways, like:
<?php echo "#myhashtag $title"; ?>
or
<?php echo '#myhashtag '.$title; ?>
but it just echoes the text, not the $title.
Any ideas will be greatly appreciated.
You can use the approach of this Wordpress plugin i made (Publicize With Hashtags), which does exactly that. It basically use and action trigger bound to the 'save_post' native event.
If you want to develop your own one you can have a look at my Source Code on the project's GitHub page or in this installation & usage guide I wrote about it.
You can add a filter, like so, to your theme's functions.php or a site-specific plugin:
add_filter( 'wpas_default_prefix', 'add_default_publicize_hashtag_prefix', 10, 4 );
function add_default_publicize_hashtag_prefix() {
$default_tags = '#yourhastaghere ';
return $default_tags;
}
This will add your default hashtag before your title without you needing to hack the WordPress core.
jetpack/modules/publicize/ui.php itself states in its comments:
/**
* Only user facing pieces of Publicize are found here.
*/
You added your hashtag in the textarea which allows admins to enter a custom message (click edit and it will slide down with your hashtag).
As #Yazmin mentioned, the best way to permanently edit the message is using a filter. The filters available are wpas_default_prefix, wpas_default_message, and wpas_default_suffix.
Personally, I had no success using these filters and I'm interested in a working solution to this issue myself.

Silverstripe tinyMCE add custom plugin

I've downloaded a plugin for tinyMCE I want to use in the CMS Silverstripe backend. I've tried to add the line in mysite/_config.php as told in http://doc.silverstripe.org/htmleditorconfig
HtmlEditorConfig::get('cms')->enablePlugins('../../textmetrics');
HtmlEditorConfig::get('cms')->addButtonsToLine(2, 'TextMetrics'); // positions plugin
And added the Plugin into /sapphire/thirdparty/tinymce/plugins/textmetrics.
That didn't work. So I tried to do the same as in /cms/_config.php where the configuration is set for the editor and put the plugin into /cms/javascript/tinymce_textmetrics. Then I tried to load with
HtmlEditorConfig::get('cms')->enablePlugins(array('TextMetrics' => '../../../cms/javascript/textmetrics/editor_plugin_src.js'));
HtmlEditorConfig::get('cms')->insertButtonsBefore('tablecontrols', 'TextMetrics'); // positions plugin
I've tried to use insertButtonsBefore insteat of addButtonsToLine just to see if there was a problem.
But nothing happens at all.... not even errormessages and I don't know what to do. I need extra plugins to load.
Help appreciated.
Thx Spanky
I've learned now, to test if the plugin works without Silverstripe and if it does, you can use this way to add it in Silverstripe. This is how it worked for me.
Put the Plugin in /htdocs/cms/javascript/pluginname . Then add the following code to /htdocs/cms/_config.php
HtmlEditorConfig::get('cms')->enablePlugins(array('pluginname' => '../../../cms/javascript/pluginname/editor_plugin_src.js'));
HtmlEditorConfig::get('cms')->insertButtonsBefore('tablecontrols', 'pluginname'); // positions plugin*/
It would be nice if TinyMCE would throw errors if it does not work, but apparently it doesn't. Neither does Silverstripe.

Magento guest checkout won't make it to shipping info

For some odd reason when people try to use guest checkout it just allows them to enter billing information then when it supposed to go to shipping... it just loops back to the first checkout page... the the process keeps repeating
anyone know where this may be coming from?
the site is a2iwheels.com/checkout/onepage/
Your Magento install is incorrect. According to this report it looks like you're missing the PHP MCrypt extension:
http://www.a2iwheels.com/report/?id=500049770619&s=default
Here's a few tips when debugging Magento problems:
First:
Enable debug/developer mode by uncommenting/adding the following lines to the Magento index.php file:
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
Second:
Setup the Magento exception log:
In the Magento Admin, go to System->Configuration
In the left column, click on Developer (under Advanced)
If it’s not expanded, Click on Log Settings
Select Yes from the “Enabled” drop down
Click on Save Config
Note that you'll need to manually create the log files before Magento begins writing to them.
Third
Install FireBug and use it to catch AJAX errors - the single page checkout is essentially one complicated AJAX page.
Go to /app/design/frontend/base/default/template/checkout/onepage/payment.phtml
and change the following code (line 36)
<fieldset>
<?php echo $this->getChildHtml('methods') ?>
</fieldset>
to this
<fieldset id="checkout-payment-method-load">
<?php echo $this->getChildHtml('methods') ?>
</fieldset>

Categories