Jump to content

Copy files from module to specific folders


Rain_xx

Recommended Posts

Hello,

I've got this big issue:

'til Prestashop v1.4 I get to copy a file form my module to the mail folder of my shop with this code:

!copy(_PS_MODULE_DIR_.'mails/'.$value.'/myfile.txt',_PS_MAIL_DIR_.'/'.$value.'/myfile.txt')

 

 

But it doesn't work from v1.5 ...what do I have to change?

 

 

Thanks a lot.

Link to comment
Share on other sites

oh, sorry for order states that is different.  Here is code I use that works for 1.4-1.5, probably 1.6 as well.

copy(dirname(__FILE__).'/../../modules/'.$this->name.'/copymails/en/filename.txt', dirname(__FILE__).'/../../mails/en/filename.txt');
copy(dirname(__FILE__).'/../../modules/'.$this->name.'/copymails/es/filename.html', dirname(__FILE__).'/../../mails/es/filename.html');

one must of course have write access which typically we do unless the shop file owner is not correct...

Link to comment
Share on other sites

Is the "(dirname(__FILE__).'/../../modules/'.$this->name.'/" path absolute or I have to edit it?

I've put the mails folder in the main one: mymodule/mails.

 

in the example I gave my module has mails in copymails.  You would need to change this to match where in your module folder the mail templates are located. :)

Link to comment
Share on other sites

in the example I gave my module has mails in copymails.  You would need to change this to match where in your module folder the mail templates are located. :)

of course. but I'm asking about the path that regards the bold part:

copy(dirname(__FILE__).'/../../modules/'.$this->name.'/copymails/en/filename.html'

Edited by Rain_xx (see edit history)
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...