Kaper Posted December 19, 2021 Share Posted December 19, 2021 Hello guys, i need to add following code into product-list.tpl , which works, but only on the 1st page (With blocklayered module enabled) Both codes working only on the 1st page (pagination) {if file_exists("video/{$product.reference}.mp4")} <CODE HERE> {/if} I have also tried this: {assign var="video_reference" value="video/{$product.reference}.mp4"} {if file_exists($video_reference)} <CODE HERE> {/if} If i am right, i need to enter this condition as variable in product.php, but i have no knowlege to do that, is there anybody who can tell me how? Thanks and i really appreciate any answer! Have a nice day! Link to comment Share on other sites More sharing options...
SmartDataSoft Posted December 19, 2021 Share Posted December 19, 2021 Hello, @Kaper Which version of PrestaShop you are trying to do and also which theme. Is it PrestaShop 1.6 or 1.7 theme. Thank you Link to comment Share on other sites More sharing options...
Kaper Posted December 19, 2021 Author Share Posted December 19, 2021 (edited) 1.6 default theme sorry i have forgot to mention that info Edited December 19, 2021 by Kaper (see edit history) Link to comment Share on other sites More sharing options...
SmartDataSoft Posted December 19, 2021 Share Posted December 19, 2021 Hello, is this work for you video/{$product.reference}.mp4 where you put the video url,. can you give more information. also your file name. Thank you Link to comment Share on other sites More sharing options...
Kaper Posted December 19, 2021 Author Share Posted December 19, 2021 My video files are stored in https://mysite.com/video/product-reference-number.mp4 . The video files are named the same as the product reference are. I just need to create condition if the file name "../video/{$product.reference}.mp4" (With variable product reference) exists, then do something... In my case: i need to show video icon when product have the video. (IT means, if the video file exists with name of the product reference) So i just need to show VIDEO ICON on the product list, when the video file for the product exists. Hope you can now understand what i need Sorry for my eng. Link to comment Share on other sites More sharing options...
SmartDataSoft Posted December 19, 2021 Share Posted December 19, 2021 @Kaper After research i have come in this conclusion that the way you are trying is not possible you need to create a hook and use that in product-list.tpl after than handel the hook code to show your video icon product-list.tpl {hook h="displayProductVideo" product=$product} and hook code public function hookDisplayProductVideo($params){ return '<i class="icon-home"></i>'; } This code show the icon, you need to handel the params to show thank you Link to comment Share on other sites More sharing options...
Kaper Posted December 19, 2021 Author Share Posted December 19, 2021 Thanks, where i have to put the hook code? public function hookDisplayProductVideo($params){ return '<i class="icon-home"></i>'; } So instead: return '<i class="icon-home"></i>';return '<i class="icon-home"></i>'; return '<i class="icon-home"></i>'; I have to put this? return '{if file_exists("video/{$product.reference}.mp4")} <!-- my code to show icon here --> {/if}'; Link to comment Share on other sites More sharing options...
SmartDataSoft Posted December 19, 2021 Share Posted December 19, 2021 @Kaper You need to create a custom module to do that. For my case i have put inside the blockbanner module and then run. I will send you the solution if i am able to solve more. thank you Link to comment Share on other sites More sharing options...
Kaper Posted December 19, 2021 Author Share Posted December 19, 2021 (edited) Thanks, i really appreciate your time Edited December 19, 2021 by Kaper (see edit history) Link to comment Share on other sites More sharing options...
SmartDataSoft Posted December 19, 2021 Share Posted December 19, 2021 This work when the block layer module is disable. {hook h="displayProductVideo" reference=$product.reference} public function hookDisplayProductVideo($params){ $reference =$params['reference']; if(file_exists("video/".$reference.".mp4")){ return '<i class="icon-home"></i>'; } else{ return ''; } } Now it is late night i am going to sleep if any other can help you to pass value in block layer then this will solve the issue. Thank you Link to comment Share on other sites More sharing options...
Kaper Posted December 19, 2021 Author Share Posted December 19, 2021 Thanks, but i need a solution to work with block layered enabled ... Link to comment Share on other sites More sharing options...
Kaper Posted December 24, 2021 Author Share Posted December 24, 2021 Bump, if anyone interested in help to me i would appreciate. Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now