Jump to content

Call modul function by link in template + Cron action


Recommended Posts

Hi Prestashopers,

 

I am trying to make my first module and got stuck. I have template with list of items. I want to have link <a> tag and call by it modul function with param. Function will send email. 

 

Second thing. I can configure on/off for autosending and interval. And I want to setup cron to start module function every day.

I got this, but I don't know if it's correct.

 

In construct i call $this->useCronTask();


	public function useCronTask()
	{
		$check_time = strtotime('now - 1 day');

		if ((int)Configuration::get('MYMODULE_CRONT_TIMER') < (int)$check_time) {
			if ((int)Configuration::get('MYMODULE_SEND_NOTIFY')) {

				$interval = (int)Configuration::get('MYMODULE_SEND_NOTIFY_INTERVAL');

                                //function of cron
				Configuration::updateValue('MYMODULE_CRONT_TIMER', (int)$check_time);
			}
		}

	}

Thanks for any help :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...