Jump to content

No template found for module problem


Recommended Posts

Hello,

 

I have run into a problem with a module I created. The module works perfectly on a WAMP server, but when I try to go live I am getting the "No template found for module" error message on pages NOT running the module. I'll explain the problem more clearly.

 

My module only applies to selected categories, if a category is not selected then the product-list.tpl is returned. My module works fine on the selected category pages, but when you go to a non-selected category page instead of the product-list.tpl file being returned the error message appears.

 

The piece of code containing the return is:

 

$checked_categories = explode(',', $checked_categories);

if(!in_array(Tools::getValue('id_category'), $checked_categories))

return $this->display(__FILE__, '../../product-list.tpl');

 

As I mentioned above this code works perfectly on the WAMP server, but not when I go live (currently in a sub folder not the root folder as I am still testing). I have tried every variation to the path I can think of, but I still keep getting the error message "No template found for module".

 

Any help would be appreciated. I am using Prestashop version 1.6.1.3    Thank you.

 

 

Kathleen

Link to comment
Share on other sites

So you are returning 'product-list.tpl' only when the id_category value is NOT in the checked_categories array.

 

And where exactly is product-list.tpl located in relation to your php file?  according to your code, product-list.tpl should exist 2 folders up from your php file

Link to comment
Share on other sites

Hello bellini13,

 

Thank you for helping me with this problem. That is correct I am only returning the product-list.tpl when the id_category is NOT checked in the array. The path in the code works perfectly on the WAMP server, but not when I go live.

 

My module is in the Prestashop modules folder. The product-list.tpl is in the Themes root folder, which is in the Prestashop Themes folder.

 

Thank you.

 

 

Kathleen

Link to comment
Share on other sites

why would product-list.tpl being the themes root folder?  It doesn't belong there.

 

so you have a module, and its main class is ... modules\module\module.php

 

And inside this module, you have the following statement...

return $this->display(__FILE__, '../../product-list.tpl');
 
which means that product-list.tpl needs to be located at the root of the prestashop store, which is definitely the wrong place.  The product-list.tpl should be located inside of the active theme folder...  \themes\theme\product-list.tpl
 
Your code needs to change, its irrelevant to me if it works on your local wamp server, since I have no idea what you might have done to make it work...
Link to comment
Share on other sites

Hello bellini13,

 

Sorry I made a mistake, the product-list.tpl is inside the active theme folder. I am very new to Prestashop and coding so have some patience with me and my replies.

 

It is inside /themes/PRSADD016/product-list.tpl  (PRSADD016 being the theme name).   Thanks

 

 

Kathleen

Link to comment
Share on other sites

Then this line of code will not work.  As I stated, it does not point to your theme folder, it points to the root of your store.

return $this->display(__FILE__, '../../product-list.tpl');
 
Perhaps try this instead
return $this->display(__FILE__, 'product-list.tpl');
Link to comment
Share on other sites

Hello,

 

I have done a lot of testing and I can link to any file outside of my themes folder, but if I try to link to a file inside the themes folder, it does not work. Can someone tell me if you think it could be because my theme name folder is in capitals - PRSADD016. I know that capital letters can cause problems with some servers.

 

If so, what is the best way for me to change the theme folder name to small letters, without causing major problems.  Thank you.

 

 

Kathleen

Link to comment
Share on other sites

Hello,

 

Getting pretty desperate here!!

 

I still cannot return the product-list.tpl file, receiving only the "No template found for module" error message. It is not a path problem as I have managed to return other test files - all of them however have been outside of the theme folder. As soon as I try to return a file that is in my theme folder I get this error message.

 

Is there another reason I would be receiving this error message? I really cannot go live with my web site until this problem is resolved. Thanks

 

 

Kathleen

Link to comment
Share on other sites

Hello,

 

I am still trying to find an answer to my problem.

 

I can return 'Hello World' on both the WAMP server and live server, but if I replace return 'Hello World' with the following code:

 

return $this->display(__FILE__, '../../product-list.tpl');

 

the results only show up using the WAMP server and NOT on a live server instead I receive the 'no template found for module'. Someone out there must have a suggestion as to why this is not working on a live server.  Thanks

 

 

Kathleen

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