kuldeepchitrakar Posted December 30, 2013 Share Posted December 30, 2013 HI I have created a sample module and want to display product category name and product name on the tab. <h1>{$category->name|escape:'htmlall':'UTF-8'}</h1> displays the category name but <h1>{$product.name|escape:'htmlall':'UTF-8'}</h1>\ does not show anything. Just blank. Whats wring with the above code. Link to comment Share on other sites More sharing options...
NemoPS Posted December 30, 2013 Share Posted December 30, 2013 WHere are you trying to display this, exactly? If one the product page, you must use $product->name. Otherwise, it depends on how the product variable is assigned Link to comment Share on other sites More sharing options...
vekia Posted December 30, 2013 Share Posted December 30, 2013 can you show your code, where you have got $product variable definition? (in your module .php core) Link to comment Share on other sites More sharing options...
kuldeepchitrakar Posted December 30, 2013 Author Share Posted December 30, 2013 (edited) Actually I want to pass the category name and product name to a one of the function which shows prices of product. to test this I was trying to print category name and product name. I want to display this on product page in a tab. Here is the linke to sample website: http://www.tawlar.com/index.php?id_product=1&controller=product here is the code <div id="belvg_product_tab"> {*call the content, sent by producttab.php script to this template :*} {$contant} <table id="priceTable"></table> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script type="text/javascript" src="http://cdn.test.com/compare.js"></script> <script type="text/javascript"> $(document).ready(function(){ initComparison('{$category->name|escape:'htmlall':'UTF-8'}','{$product.name|escape:'htmlall':'UTF-8'}','testu','testp'); });</script> <h1>{$category->name|escape:'htmlall':'UTF-8'}</h1> <h1>{$product.name|escape:'htmlall':'UTF-8'}</h1> </div> Edited December 30, 2013 by kuldeepchitrakar (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted December 30, 2013 Share Posted December 30, 2013 In this case, as it's the product page, use $product->name Link to comment Share on other sites More sharing options...
kuldeepchitrakar Posted December 30, 2013 Author Share Posted December 30, 2013 Hi I changed it to but still it does not work. I recompiled the tpl file and set the cache to to no but no success. <h1>{$product->name|escape:'htmlall':'UTF-8'}</h1> Link to comment Share on other sites More sharing options...
NemoPS Posted December 30, 2013 Share Posted December 30, 2013 Are you sure the name is filled in for the chosen language? Which is the tpl file you are editing? It must be loaded after the product controller in order to work Link to comment Share on other sites More sharing options...
kuldeepchitrakar Posted December 30, 2013 Author Share Posted December 30, 2013 Hi I am using module code from this link http://blog.belvg.com/developer-tips-creating-a-tab-on-the-frontend-product-page-in-prestashop.html and I have added my contents in the productTabContent.tpl. I hope its correct. Link to comment Share on other sites More sharing options...
NemoPS Posted December 30, 2013 Share Posted December 30, 2013 That was for 1.4 it seems, what's your prestashop version? It should be fine anyway. On 1.5, on that hook, this {$product|debug_print_var} Returns all product data, so it should work Link to comment Share on other sites More sharing options...
Recommended Posts