Prestashop - additional code when deleting a customer - prestashop

I would like to add the code associated with one of the modules that should be executed when the client is removed by the administrator in the back office. Where should I put this code? I cant find the right file.
Update
I added this code to the module for testing, but it doesn't seem to do anything.
public function hookActionObjectCustomerDeleteAfter($params)
{
$customer_id = (int)$params['object']->id;
PrestaShopLogger::addLog(
sprintf('Customer with id %d was deleted with success', $customer_id)
);
}

I guess the right hook would be hookActionObjectCustomerDeleteAfter in some custom module. Don't forget to register your module to the hook before launching the code. You can do this during a module install process in install method with code $this->registerHook('actionObjectCustomerDeleteAfter')

Use hook hookActionObjectProductDeleteAfter.

Related

Need help on a minimal module for prestashop 1.7.x

I would like to write a module for prestashop 1.7.x for the first time !
It would be nice if someone could give me a hint how to start up.
I would like to use a php function with smarty call like {$page.page_name|test}
Hi #Hardy Thiergart and welcome to SO!
You can easily write your first PrestaShop module by following the tutorial here:
https://devdocs.prestashop.com/1.7/modules/creation/
Main steps:
Create a folder with your module's name
Create a PHP file with the same name
Make sure your PHP file contains at least the __construct(), install(), uninstall() and getContent() methods (the last one is required only if you allow users to 'Configure' this module)
You can then add additional methods for Hooks, including calls to your template files
Once ready, create a zip file of this folder, with your module's name
I hope this helps.
Here is a link to generate an empty Prestashop module with hooks, etc ... : https://validator.prestashop.com/auth/login
Regards

Odoo 9 - cannot load custom module

I am brand new to odoo, just installed version 9 and made a module 'aidentest' using
.>>python odoo.py scaffold aidentest addons
That created the aidentest module in the addons folder. Uncommented everything in the autogenerated files
but when I went to check out my 'Hello World' page at
http://localhost:8069/aidentest/aidentest
I got a 404 not found
So I went to apps to try and load my module, but I could not find it.
Does anyone know what I need to do on Odoo 9 to load up and start coding my custom module?
Briefly: You have to activate developer mode by going to Top right menu>about>activate developer mode
I had basically given up, and was mindlessly clicking about when I hit the 'About' link on the generic-whiteguy dropdown. I had to actually stop thinking before I was able to locate the completely senseless place where they put the thing I need.
The About modal window popped up, and in it was an activate the developer mode button
Some things changed immediately, but I still couldn't find my custom module.
Then I walked away, came back and when I returned I had some auto-generated emails (new things had loaded - slowly). Did this mean that maybe my module had also become accessible? I checked, and sure enough, there it was.
ZERO DOCUMENTATION about this
Please check the config file.Then send the last error it has.

Safari Extension: "on install" event?

I am developing an extension for Safari 6 and I want to set some default values for my settings. These default values depend on window.navigator.language, so setting them in Settings.plist does not the trick – I need to run some JS code to set them.
Obviously, this code should only run once right after install. And it shouldn't run after simply reenabling the extension.
Is there an "official" event that I can attach a function with addEventlistener to? Or do I really need the trick with setting a helper variable?
There is no official event that I know of. But it's pretty easy to do something like this in your global page:
if (!safari.extension.settings.hasRun) {
safari.extension.settings.hasRun = true;
safari.extension.settings.lang = window.navigator.language;
}

how to call only blocktopmenu module in prestashop

can anyone tell me how to call only blocktopmenu module in prestashop...if i use displayTop hook it calls various other modules along with it..but i only want to call blocktopmenu..is it possible to create an object of Blocktopmenu class and access the hookDisplayTop() of that class..so that i can avoid other modules...i tried but its not working
when i try to implement this
Call Module in tpl file in prestashop
it shows "This module cannot be transplanted to this hook."
When you call Hook::exec() you can specify a module ID in the 3rd parameter.
It would be something like that:
Hook::exec('displayTop', null, Module::getModuleIdByName('blocktopmenu'));
Regards,
Never touch the FrontController.
You have to create a new hook, then attach your module to this hook.
After that, you can call Hook::exec('your_hook').

Why will some modules load and some modules not load in FLEX 3?

I have an app with several modules. There is only one module loaded at anyone time. 2 out of the 3 modules load without problems but the third a new module will not fire the ModuleEvent.Ready. I have an event handler function that handles the ModuleEvent.PROGRESS and it just traces out the bytes loaded vs bytes total. It seems to load the module completely yet never fires the ready event. Here is how I am loading the modules:
public var moduleInfo:IModuleInfo;
public function loadModule(url:String):void{
if(moduleInfo != null)
moduleInfo.release();
moduleInfo = ModuleManager.getModule(url+"?"+"x="+Math.random().toString());
moduleInfo.addEventListener(ModuleEvent.READY,moduleLoadHandler,false,0,true);
moduleInfo.addEventListener(ModuleEvent.PROGRESS,onModuleProgress,false,0,true);
moduleInfo.load(ApplicationDomain.currentDomain);
}
Ok, turns out it has been a long time since I created a new module. I forgot one critical thing. Since my modules are in separate projects, I need to change the root tag of the main mxml file from Application to Module. :)
Live and learn and never be ashamed to admit when you are wrong.