Jump to content

[HELP] Access $_GET Value from Module


Recommended Posts

Hello guys. I recently started to work with PrestaShop Modules, and I really enjoy it! =] Now I have stumbled accross a problem:

 

How can I access a custom $_GET value, defined in Front-Office from a Module PHP File? I need this, to make it possible to add a cronjob.

 

Huge Thanks,

Ralph.

Link to comment
Share on other sites

hope this helps:


as a comparator
if(Tools::getValue('getname') == 'somevalue')

just to obtain the value
$i = Tools::getValue('getname') 

for cron job, make sure you have the  token for security purposes....see gstiemap module for examples

Thank you for the reply. Well, this part it not the problem.. The problem is, I dont know how to access this GET value from a Module. The GET value is set in the Frontpage, not in the Modules Config. I need to read it from my module.

 

For Example:

 

domain.com/en/?generateXML    - this is where the GET is

modules/my_module/my_module.php  -  here i need to read it

Edited by Rawsteel (see edit history)
Link to comment
Share on other sites

you would need to build the url (clickable link)

as example on one of my modules...

 

$this->cron_url = _PS_BASE_URL_._MODULE_DIR_.'yourmodfolder/yourmod-cron.php?token='.substr(Tools::encrypt('yourmodule/cron'), 0, 10).'&parm=crontab';

 

So the module would need a way to display a link to itself...

 

Hope I am helping :)

Link to comment
Share on other sites

you would need to build the url (clickable link)

as example on one of my modules...

 

$this->cron_url = _PS_BASE_URL_._MODULE_DIR_.'yourmodfolder/yourmod-cron.php?token='.substr(Tools::encrypt('yourmodule/cron'), 0, 10).'&parm=crontab';

 

So the module would need a way to display a link to itself...

 

Hope I am helping :)

 

Thank you for your help, Patron! :) I think I got what you mean. Trying to implement it now, I will report back in minutes.

Link to comment
Share on other sites

Thank you for your help, Patron! :) I think I got what you mean. Trying to implement it now, I will report back in minutes.

best to report back when you have it working..that is easier for me..jajajajaja

 

but if you report back that you do 'not' have it work...then please drop and give us 50 before posting...one must also stay fit...

Link to comment
Share on other sites

×
×
  • Create New...