Jump to content

Include .tpl from a module INTO another module's .tpl


Recommended Posts

Hi guys!

I bought a module called Bestkit_gifts and now I need include the admin_invoice.tpl from this module into my personal delivery slip template to show to our customers which gifts they get .

The problem is: I bought time ago a module 
called M4pdf that configures pdf  (in my case the delivery slip) and when I try put/call the template admin_invoice.tpl in this delivery_slip.tpl, I do not get anything.

 

I have tried to do:

 

1) use the hook called "displayPDFDeliverySlip" from the gifts module inside the tpl from M4pdf module, using 

{hook h='displayPDFDeliverySlip'}

or 2) Calling the file admin_invoice.tpl from the gifts module inside the tpl from M4pdf module, using:

{include file="file:/var/www/clients/.../templates/hook/admin_invoice.tpl"} // the route is not complete here

But I do not get anything!

 

My Prestashop version is 1.6.1.3

Please, can you figure out how can I include the admin_invoice.tpl into my deliveri_slip.tpl which belongs to another module?

Thanks a lot in advance!  :)
 

Link to comment
Share on other sites

The second include should work, but you need the correct relative path, without file:
you can use it like 

 

{include file=".../../path/to/wherever/templates/hook/admin_invoice.tpl"}

Just make sure you get out of the folder and then into the other with the .../

Link to comment
Share on other sites

Hi NemoPS!! In first place, a lot of thanks for your replay :)

 

I'm right now trying to do that but I do not get it, I let you here both paths if you can help me how to finally get it!

 

1) My current path: /web/modules/m4pdf/tpl/m4_deliveryslip.tpl

 

2) The path I want to go: /web/modules/bestkit_gifts/views/templates/hook/admin_invoice.tpl

 

I'm doing: {include file=".../../../bestkit_gifts/views/templates/hook/admin_invoice.tpl"} or {include file="../../bestkit_gifts/views/templates/hook/admin_invoice.tpl"} but I do not get anything!

 

 

Is it possible that being different modules I can not do this?It seems that it does not recognize the parameters defined in the module from which I want to use the template. 

 

For example, I have tried to call a .php file in the bestkit_gifts folder with this: {include file="../../bestkit_gifts/bestkit_gifts.php"} and I get this message:

 

Syntax error in template "/var/www/clients/client1/web15/web/modules/bestkit_gifts/bestkit_gifts.php" on line 1013 "$params['template_html'] = str_replace("{products}", "{products}" . $content, $params['template_html']);" unknown tag "products"

 

Again, thank you for your time!

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

Ah, if it's m4pdf then it's gonna be a pain.
The first one you tried should really work, but the error you get is actually different. You obviously need those parameters assigned, in this case after you include

{include file = '........' products = $thevariableYouWant}

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...