Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Administrator Notifications Rate Topic   - - - - -

 
  • StellarBytes
  • Senior Member
  • Members
  • Join Date: 08-Aug 11
  • 1807 posts

Posted 19 December 2011 - 07:11 PM #1

Hey everybody

I was just wondering if anybody has modified the admin/control panel/dashboard area for the purpose of displaying messages for administrators as per the attachment.
Attached File  cs-cart-admin-notifications.jpg   78.27KB   55 downloads
It would be very handy to have this functionality to display messages to all administrators on the admin side.

If this hasn't already been covered, and you think you can provide a solution, please get in touch.


Thanks
Hire StellarBytes for CS-Cart Design & Development Services

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11363 posts

Posted 20 December 2011 - 12:18 AM #2

Pretty easy... Create addons/my_changes/controllers/admin/auth.post.php
add:
[code=auto:0]
<?php
if( !defined('AREA') ) die('Access denied');

if( $mode == 'login' && !empty($_SESSION['auth']['user_id']) )
fn_set_notification('E', "Hey You!", "Read this message!", true);
return array(CONTROLLER_STATUS_OK);
?>
[code=auto:0]

Might have to adjust the if statement above related to mode and user_id. But you get the idea.....

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • StellarBytes
  • Senior Member
  • Members
  • Join Date: 08-Aug 11
  • 1807 posts

Posted 20 December 2011 - 06:16 PM #3

Thanks, that was certainly straightforward enough - I haven't yet got the hang of my_changes just yet, but have made a few changes and borrowed some code, to create 3 language variables:

'reminder' - Reminder (instead of Warning or Note)

Value: "Reminder"

'reminder_message' - Editable message (via Languages) to be shown to administrators in control panel.

Value: "Blah blah blah..."

'reminder_message_edit_link' - Contains link to Languages search for 'reminder_message', thus it can be clicked on to take you straight to the field which requires editing for displaying the message.

Value: "[<a href="admin.php?q=reminder_message&dispatch=languages.manage&x=0&y=0">Click Here to Change Text</a>]"


<?php

//
// $Id$
//

if (!defined('AREA')) { die('Access denied');    }

if ($mode == 'login') {
    if (!empty($_SESSION['auth']['user_id'])) {
        fn_set_notification('E', fn_get_lang_var('reminder'), fn_get_lang_var('reminder_message'), fn_get_lang_var('reminder_message_edit_link'), 'S');

    }
}

?>

However, reminder and reminder_message are displayed, but regardless what value I enter into reminder_message_link_edit, nothing is rendered.

What I am trying to do is have the message display like so:

Reminder: Blah Blah Blah [Click Here to Change Text]

Any idea why this wouldn't work? I've looked at other calls to 'fn_set_notification' in the cart and they use the same syntax...

Thanks!
Hire StellarBytes for CS-Cart Design & Development Services

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11363 posts

Posted 20 December 2011 - 07:43 PM #4

Change this to:
 fn_set_notification('E', fn_get_lang_var('reminder'), fn_get_lang_var('reminder_message') ." ". fn_get_lang_var('reminder_message_edit_link'), 'S');
[

You might bracket the whole thing in
[code=auto:0]
if( fn_get_lang_var('reminder') ) {
your code
}

This way you can have it do nothing if there is no reminder value in the 'reminder' variable.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • StellarBytes
  • Senior Member
  • Members
  • Join Date: 08-Aug 11
  • 1807 posts

Posted 20 December 2011 - 08:30 PM #5

Excellent, that's done it. Thanks for your help tbirnseth, I have also included the extra if statement to make the reminder notification optional ;)

Here's the full answer:

Create addons/my_changes/controllers/admin/auth.post.php with the following content:
<?php

if (!defined('AREA')) { die('Access denied');	}

if ($mode == 'login') {
	if (!empty($_SESSION['auth']['user_id'])) {
		if( fn_get_lang_var('reminder_message') ) {
		fn_set_notification('E', fn_get_lang_var('reminder'), fn_get_lang_var('reminder_message') ." ". fn_get_lang_var('reminder_update_link'), 'S');
		}
	}
}

?>

Now, go to Administration > Languages > 'Add Language Variable', do this step for each new language variable.

Language Variable: reminder
Value: Reminder

Language Variable: reminder_message
Value: Enter whatever message you want to show to administrators throughout the control panel.

Language Variable: reminder_update_link
Value:
[<a href="admin.php?q=reminder_message&dispatch=languages.manage&x=0&y=0">Update Reminders</a>]

Save, refresh the admin cache, and your reminder messages will now display on the control panel like so:

Note: If you leave the 'reminder_message' value empty, the notification box will not appear, thus, you can display the admin notifications only when you require.

Attached Files


Hire StellarBytes for CS-Cart Design & Development Services

 
  • buging
  • Member
  • Members
  • Join Date: 12-Jan 11
  • 332 posts

Posted 27 November 2012 - 07:23 AM #6

Does anyone have an idea how to do this in 4.0.3?