I realise I can but I am reluctant to edit any of the core files.
Thanks for your well.
I realise I can but I am reluctant to edit any of the core files.
Thanks for your well.
Eventually, you will have to anyway. For example, files inside includes/modules/pages have not over-ride.
I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me
For my own use, I have no hesitation and reluctance is for stuff I am thinking might be put up for general download.
Anyway, I will be looking and the notifiers to understand how they work.
Thanks for the pointer
Hello.
This is a follow up to this thread http://www.zen-cart.com/forum/showthread.php?t=88191
I decided to implement a custom notifier but no joy as the event does not seem to trigger my code.
The aim is to edit the DB entries after a user clicks "update" in a payment module admin.
What I have done so far is
1) In module.php, I added
after the while loop that includes....PHP Code:$zco_notifier->notify('NOTIFY_MODULE_AFTER_ADMIN_SAVE_DB_UPDATE');
$db->Execute("update " . TABLE_CONFIGURATION . "
set configuration_value = '" . $value . "'
where configuration_key = '" . $key . "'");
in the "save" switch section. This should call the notifier if I understand the process correctly.
2) in includes/autoloaders, I created a file called config.mynewclass.php with the following code...
QUERY >> Not sure which breakpoint to use as the wiki is not clear on this. Any tips?PHP Code:<?php
$autoLoadConfig[180][] = array('autoType'=>'class',
'loadFile'=>'observers/class.mynewclass.php');
$autoLoadConfig[180][] = array('autoType'=>'classInstantiate',
'className'=>'mynewclass',
'objectName'=>'mynewclass');
?>
3) In classes/observers, I created a file called class.mynewclass.php with the following code...
QUERY >> Can anyone spot where I may have goofed?PHP Code:<?php
class mynewclass extends base {
function mynewclass() {
global $zco_notifier;
$zco_notifier->attach($this, array('NOTIFY_MODULE_AFTER_ADMIN_SAVE_DB_UPDATE'));
}
function update(&$callingClass, $notifier, $paramsArray) {
My code....
}
}
?>
Thanks for your help
After checking, I am not so sure it doesn't work in Admin as config.core.php in admin/includes instantiates zco_notifier.
I will try to place my files in admin/includes/auto_loaders and admin/includes/classes/observers (after creating the observers folder) and see what happens.
OK I can see there isn't the equivalent of class.base.php in admin which contains all the notifier functions.
Wonder why zco_notifier is instantiated though.
Perhaps one of the gurus can give a definitive answer on whether this is a goer or not.
Support for observer/notifier functionality in the admin is limited.
Additionally, the admin shares many catalog-side functions/classes files, including class.base.php etc.
BTW ... your threads have been merged, due to similarities and same end goal.
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
OK thanks
i found a way round my problem by restructuring what i am doing.